Re: Float comparison
- From: gordonb.rhrsn@xxxxxxxxxxx (Gordon Burditt)
- Date: Mon, 04 May 2009 14:22:40 -0500
No, you misunderstand. Cbf(whatever that is. In any case, it's not relevant.)
is stating that a value represents a range.
Physics also emphasizes that measurements are inherently inaccurate,
especially when using instruments cheap enough they'll let YOU use
them. Early on you learn that "95.000 inches" implies much greater
measurement accuracy than "95.0 inches", whether you get that
measurement anywhere near a computer or calculator or not.
There's even this guy Heisenburg who says that you can't simultaneously
know the position and momentum of something (typically a particle,
but this also applies to posters and planets) to arbitrary precision.
Perfect precision isn't even possible.
Error analysis views all numbers as ranges whether the programming
language used to calculate admits it or not.
When you put a measurement in a floating-point number, there's error
from the measurement and potentially error from the floating-point
number. (If FLT_RADIX is 2, typical of existing hardware, most
decimal numbers are not exactly representable.) A C double has a
minimum of 10 significant digits, and 15 if it's an IEEE double.
Most measurements, except perhaps currency and time on a historical
scale, require very expensive equipment to get more than 10 significant
digits of accuracy. Therefore, the measurement error usually
dominates any rounding error from putting it in a floating-point
number. If you're using floats rather than doubles and the
measurement error doesn't dominate the floating-point rounding
error, you should probably be using doubles or long doubles.
Whether or not the error in a measurement is absolute (e.g. within
one-eighth of an inch using this tape measure) or relative (fuel
pumps measure volume to within 0.3% of the volume delivered to meet
NIST standards) usually depends on how the measurement is done, not
on details of the floating-point representation. Actually, most
measuring devices have *both* absolute and relative limits. That
fuel pump may have limits of 0.3% and 0.01 gallons, and the absolute
limit dominates if you pump tiny amounts of fuel.
Once you start calculating with the numbers, more floating-point
rounding error can be introduced. Some problems exhibit numerical
instability, in which a tiny variation of the input makes a huge
difference in the result.
.
- Follow-Ups:
- Re: Float comparison
- From: nick_keighley_nospam
- Re: Float comparison
- From: Keith Thompson
- Re: Float comparison
- From: Phil Carmody
- Re: Float comparison
- References:
- Re: Float comparison
- From: *** T. Winter
- Re: Float comparison
- Prev by Date: Re: About floating number arithmetic
- Next by Date: Re: Float comparison
- Previous by thread: Re: Float comparison
- Next by thread: Re: Float comparison
- Index(es):