Article View: alt.folklore.computers
Article #698Re: Problem in Turbo Pascal 4.0 (fuzzy float compares)
From: John Gilmore
Date: Mon, 08 Jan 1990 00:10
Date: Mon, 08 Jan 1990 00:10
23 lines
1849 bytes
1849 bytes
The APL language defines fuzzy floating point operations as part of its
"one kind of numbers" model -- there is no difference between boolean,
integer, float, complex, etc -- they all look like numbers. This
started about 1966 or so and has been in use ever since. Most users
don't notice (which is the idea). The scheme has been refined over the
years, and various papers have been written on how to do "fuzzy
residue" (modulus), preserve most or all of the desired numeric
properties such as transitivity, etc.
The comparison tolerance is user-settable and you can set it to zero if
you want exact comparisons. Most people leave it at the default, about
1E-13 or so as I recall. The tolerance is proportional to the
magnitude of the numbers, so two numbers like 1.484736726287284746E100
that differ in the 18th digit will compare equal.
In the APL world, last time I looked, "fuzz" is considered a qualified
success. APL folks take their math seriously (check into their
treatment of rounding and output conversion sometime). I'm surprised
the rest of the world hasn't used it -- though it does make float
compares slower.
--
John Gilmore {sun,pacbell,uunet,pyramid}!hoptoad!gnu g...@toad.com
Just say *yes* to drugs. Say "no" to undeclared wars on sovereign countries.
Technical Details
Message-ID:
<9544@hoptoad.uucp>Path:
mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!apple!rutgers!ucsd!ucbvax!hoptoad!gnuReferences:
<129838@sun.Eng.Sun.COM> <381@ns-mx.uiowa.edu>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!gmdzi!unido!mcsun!uunet!samsung!usc!apple!rutgers!ucsd!ucbvax!hoptoad!gnu From: gnu@hoptoad.uucp (John Gilmore) Newsgroups: alt.folklore.computers Subject: Re: Problem in Turbo Pascal 4.0 (fuzzy float compares) Message-ID: <9544@hoptoad.uucp> Date: 8 Jan 90 00:10:09 GMT References: <129838@sun.Eng.Sun.COM> <381@ns-mx.uiowa.edu> Organization: Grasshopper Group in San Francisco Lines: 23 Posted: Mon Jan 8 01:10:09 1990 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit