Hello I've a question for 8087 co processor I've real number in 'x'(DQ) I want to display this number in form of "mantissa * 10^(exponents)" of course, 1 <= mantissa < 10 1st. I tried to get exponent FLD1 (load 1) FLD x (load x) FYL2X (ST(0)=log_2 x) FLDLG2 (load log_10 2) FMUL ((log_2 x)*(log_10 2) = log_10 x = st(0)) FWAIT FIST n (store exponents in 'n') (because log_10 x = log_10 (mantissa) + exponents, and 0 <= log_10 (mantissa) < 1, so FIST get integer(exponent) part) FISUB n (log_10 - n = log_10 (mantissa)) so I can get exponents in 'n', but mantissa is still in ST(0), in the form of 'log_10 (mantissa)' if there is a command which can calculate 10^ST(0), 10^(log_10 (mantissa))=mantissa, but I couldn't find such command in 8087 only F2XM1 (which calculate '2^(ST(0)) - 1') exist, so from 2^((log_10 x) * (log_2 10)) = 2^(log_2 x) = x, BUT, there is a problem, "F2XM1 only calculate in the case of -1.0 <= ST(0) <= 1.0" so I couldn't get mantissa please help me. Thank you
Posted on 2001-05-29 09:05:00 by luna1611
It is a long time since I wrote for the 8087. If it helps at all, you can always put a copro register in a ten-byte piece of memory, by using FST or FSTP, which will let you work separately on: 1-bit sign (high in the structure) 15-bit exponent 64-bit mantissa (lowest in the structure).
Posted on 2001-05-31 17:42:00 by Larry Hammick