Peter, thanks for your note, it is very clear and I think it helps a lot,
but what you can't say is: DON'T MAKE TWO CONSECUTIVE FLOATING POINT
SUBTRACTIONS !!.
And to finish this threat, I think that a floating point subtraction MUST
give a clean answer up to it's capacity (accuracy of 14 or 15 digits):
Let's say
1.000000000000000 -
0.999999999000000
SHOULD give a result of
1.000000000000002E-9 or 9.9999999999999995E-10
and not something like:
1.000000004567891E-9 or 9.9999999998067111E-10
What would happen if I subtract 0.999999999E-9 to this numbers??
Certainly I would not get 1E-18 neither closer.
Maybe next OS we will have it fixed.
Pablo Valle


 -----Original Message-----
From:   [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]  On Behalf Of Peter
Epstein
Sent:   Martes, 19 de Septiembre de 2000 5:03 pm
To:     Palm Developer Forum
Subject:        RE: Serious Palm FloatNumber problem

I may be confused about what you're trying to do, but I think you're under
the impression that floating point numbers are stored in a base 10 format.
In fact, they're stored in base 2, with a base 2 exponent. Therefore, it may
not be possible to exactly represent the number without non-zero garbage
digits.

What John was getting at, I think, it the notion that if you're using
floating point numbers, you always need to keep track of how much useful
data there is in the number. This can be done using significant figures or
by calculating errors. If you're looking for results which are correct down
to the last digit, you probably shouldn't be using them at all. There are
more appropriate representations for such calculations. Often, the best
choice is a fixed point representation. If you're working with numbers
entered by the user, you may want to avoid round-off induced by base
conversion by storing numbers in the same base as they're entered (or a
power of that base).
--
Peter Epstein
Palm Inc. Developer


--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to