Re: ascii to float (yet another question)
- From: "Wolfgang Kern" <kesys@xxxxxxxxx>
- Date: Wed, 28 Feb 2007 13:03:32 +0100
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 :)
.
- References:
- ascii to float (yet another question)
- From: Chewy509
- ascii to float (yet another question)
- Prev by Date: Re: Help me about this question.
- Next by Date: Re: 64 bit Menuet 0.59 released
- Previous by thread: Re: ascii to float (yet another question)
- Next by thread: Clarification on the cmp instruction
- Index(es):
Relevant Pages
|