続き
EXTERNAL FUNCTION MKLD2$(X) !'モトローラIEEE754 80bit float OPTION CHARACTER BYTE OPTION BASE 0 DIM B(80) IF X<0 THEN LET B(0)=1 IF X<>0 THEN IF ABS(X)<1 THEN DO WHILE 2^N>ABS(X) LET N=N-1 LOOP LET N=N+1 ELSE DO WHILE 2^N<ABS(X) LET N=N+1 LOOP END IF LET NN=N LET N=N+16382 FOR I=1 TO 15 IF AND(N,2^(15-I))<>0 THEN LET B(I)=1 NEXT I LET T=ABS(X)/2^NN FOR I=16 TO 79 LET T=T*2 IF T>=1 THEN LET B(I)=1 LET T=T-INT(T) END IF NEXT I END IF LET AA$=CHR$(B(0)*128+B(1)*64+B(2)*32+B(3)*16+B(4)*8+B(5)*4+B(6)*2+B(7)) LET BB$=CHR$(B(8)*128+B(9)*64+B(10)*32+B(11)*16+B(12)*8+B(13)*4+B(14)*2+B(15)) LET CC$=CHR$(B(16)*128+B(17)*64+B(18)*32+B(19)*16+B(20)*8+B(21)*4+B(22)*2+B(23)) LET DD$=CHR$(B(24)*128+B(25)*64+B(26)*32+B(27)*16+B(28)*8+B(29)*4+B(30)*2+B(31)) LET EE$=CHR$(B(32)*128+B(33)*64+B(34)*32+B(35)*16+B(36)*8+B(37)*4+B(38)*2+B(39)) LET FF$=CHR$(B(40)*128+B(41)*64+B(42)*32+B(43)*16+B(44)*8+B(45)*4+B(46)*2+B(47)) LET GG$=CHR$(B(48)*128+B(49)*64+B(50)*32+B(51)*16+B(52)*8+B(53)*4+B(54)*2+B(55)) LET HH$=CHR$(B(56)*128+B(57)*64+B(58)*32+B(59)*16+B(60)*8+B(61)*4+B(62)*2+B(63)) LET II$=CHR$(B(64)*128+B(65)*64+B(66)*32+B(67)*16+B(68)*8+B(69)*4+B(70)*2+B(71)) LET JJ$=CHR$(B(72)*128+B(73)*64+B(74)*32+B(75)*16+B(76)*8+B(77)*4+B(78)*2+B(79)) LET MKLD2$=AA$ & BB$ & CC$ & DD$ & EE$ & FF$ & GG$ & HH$ & II$ & JJ$ END FUNCTION
EXTERNAL FUNCTION AND(X,Y) LET XO=X LET YO=Y LET A=1 LET S=0 FOR I=0 TO 15 LET XX=MOD(XO,2) LET YY=MOD(YO,2) IF YY+XX=2 THEN LET S=S+A LET XO=INT(XO/2) LET YO=INT(YO/2) LET A=A*2 NEXT I LET AND=S END FUNCTION
|