Re: ascii to float (yet another question)




Hi Darran,

[..]
It basically is along the lines of:

FILD word [exp] ; st0 = exponent
FLDL2T ; st0 = log2_10, st1 = exponent
FMULP st1; st0 = exp * log2_10
FBLD [sig] ; st0 = sig, st1 = exp
FSCALE ; st0 = st0 * 2 ^ st1
if value is neg then FCHS

done! exp is the exponent biased accordingly for the imported
significant taking into account the movement of the decimal when
converting the significant to BCD.

Yes, this example is found in my hardcopy Intelbook 80287 (1984)!
But it also needs rounding-checks and is limited to 17.5 digits
precision.
A second example in this book shows a two entry 10^n table (n=17,18)
which it compares to fit the output without the off by one problem.
It's a bit more precise but also limited to max.18 digits anyway.

The main problem with the FPU is:
* it cannot work on unsigned 64 bit.
* FBLD/FBST truncate or misinterprete out of range values.
* the exponent is 2^n ordered (means 0.1 dec becomes periodic here)
* need to set rounding control according to a previous value check.
* FBLD/ST are awful slow.

So even MMX and XMM allow a few 64/128 bit Uinteger operations,
we still need our own conversion routines for print/display.

I once added a 19th digit(after the FBST-story) to fully convert
unsigned 64-bit, but since very long I rarely use the FPU at all.

__
wolfgang

[..]Nothing wrong Darran :)





.



Relevant Pages

  • Re: How to use FPU 80bit FP
    ... the precision bits in this newsgroup. ... INTEL FPU FLOATING POINT FORMATS ... FPU CONTROL WORD ... because stack faults should never be masked, ...
    (comp.lang.asm.x86)
  • Re: float bug? perl 5.8, DBI and oracle 10.2.0
    ... precision numbers in oracle, you've got 38 decimal digits to play ... and with minimal coaxing perl will handle them as ... digits from a 32 bit floating point number - I'll go out on a limb ... and hazard that one can expect 12 or so digits from a 64 bit floating ...
    (perl.dbi.users)
  • RE: float bug? perl 5.8, DBI and oracle 10.2.0
    ... I would not characterise 32-bit signed integers as giving 10 digits ... truncate and tell people you get 9 digits of precision. ... perl 5.8, DBI and oracle 10.2.0 ... Floating point values are typically stored in 64 bits or sometimes 96 ...
    (perl.dbi.users)
  • Re: float bug? perl 5.8, DBI and oracle 10.2.0
    ... I would not characterise 32-bit signed integers as giving 10 digits ... truncate and tell people you get 9 digits of precision. ... perl 5.8, DBI and oracle 10.2.0 ... Floating point values are typically stored in 64 bits or sometimes 96 ...
    (perl.dbi.users)
  • Re: 15 Significant Digits Limitation a Mistake for Spatial Informa
    ... DP does not restrict to 15 decimal digits. ... Input and output precision are more tightly linked in Excel ... Decimal data type or roll your own extended precision data types. ...
    (microsoft.public.excel)