c++ - FPU command FLDL converts double to long double in ST0 -
i have double value in c++ code:
double inch = 25.399999618530273;
when used in calculations, loaded fpu st0 register using
fldl -0x90(%ebp)
i can see double @ -0x90(%ebp) correct value. after fldl appears long double value 25.3999996185302734375 in st0 register, though compile -mpc64 -mfpmath=387 , manually sets fpu double precision before calculations , fldl command:
fpu_control_t cw; _fpu_getcw(cw); cw &= ~_fpu_extended; cw |= _fpu_double; _fpu_setcw(cw);
can please explain, why in _fpu_double mode fpu registers still in extended precision mode , how fix that?
or appears long double (i view registers in eclipse cdt) in fact operated without digits internally?
your numeral converted 25.3999996185302734375 when program compiled, because double
value (using ieee-754 64-bit binary floating-point) closest 25.399999618530273. conversion of double
long double
has no error.
when can see “double @ -0x90(%ebp)” correct value, then, if not seeing 25.3999996185302734375, not seeing actual value @ location—the tool using observe value has presented inaccurately.
if expecting double
represent 25.399999618530273 exactly, disappointed; not, , must design code allow or use other double
represent numbers this.
what tool using measures lengths precision of .000000000000001 inch? fine ruler great magnifying glass , robotically enhanced eyes?
Comments
Post a Comment