2009/7/7 Ignacio Vivona <[email protected]>:
> The float problem is an implementation problem that i really dont care, i
> only want fast float operations when doing heavy calculation or 3D or
> something like that ... 1.3 should gimme an object modeling a real number
>

OK concerning fast, that's not the main talent of Squeak, but yes, it
could be worse with ScaledDecimals.

OK, an object modelling a real number, inexactly, is what you get, so
i do not see the problem.
Float representation is independant of the language and most likely
hardwired in your processor.
Whether it is exactly equal to (13/10) or not is an implementation
detail you should not bother with...
... until you try to attempt an exact equality test, but why would you?

Because you know the tradeoff is fast but inexact, you will rather use
something like (13/10) closeTo: 1.3, or better, provide your own
tolerance.
If you say you expect (13/10) = 1.3 exactly, then i say your
expectations are different: you want an exact representation, at the
price of longer computations, that's the deal.

The fact that Smalltalk let you the choose is already a great thing.

Last time I tried (13/10) == 1.3 in C, it was false :)

Nicolas

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to