Float bug toolkit: what the hash is this?

Eliot & Linda elcm at pacbell.net
Thu Feb 19 05:38:39 UTC 1998


sqrmax at cvtci.com.ar wrote:
[snip]
> Moreover, even if they do have the same hash (due to design,
> coincidence or whatever), I think that they should not answer true to an equality
> cross-test, even if they have the 'same values'.

Why?  Why break something as simple and powerful as Smalltalk's
mixed-mode arithmetic because certain number representations are
approximations that must be used with care in certain contexts?

What do the language designers have to say about the Number system? 
Dan?

What do the numerical analysts have to say about floating-point and
numbers?  Dave?

What do the usability/comprehensibility experts have to say? Alan?

I absolutely concede that if one is using floating-point to compute
results that are required to exhibit a given accuracy then one will have
to be very aware of the representations' limitations.  But I don't see
that this means I have to quarantine more quotidian use.  It appears to
me that IEEE strives  to be usable.  Rounding-modes seem to be good
enough to save embarrasment in many cases.  For example, I tried the
following in VisualWorks:

	0.01 * 100.0 - 1.0

and I got 0.0.  Not epsilon, but 0.0.  This is presumably because some
effort has gone into the design of rounding modes.  Hence I rarely hang
myself with IEEE.  Does the fact that, if I tried very hard, I could
hang myself imply that I have to write

	i := 0.0.
	[(i - 1.0) abs <= 1.0e-6] whileFalse:
	   [self fret.
	   self developAReallyHumongousUlcer.
	   i := i + 0.1]

instead of

	0.0 to: 1.0 by: 0.1 do: [:i| self partyOnDude]

??

Yours, perplexed.
_______________,,,^..^,,,_______________
Eliot Miranda, ParcPlace





More information about the Squeak-dev mailing list