This kind of approach will introduce discontinuity problems when the FPU 
is asked to calculate sin(x) when x is close to zero... IME, most 
platforms offer a different answer to that kind of stuff.  IIRC, SGI was 
the only platform I found with "natural" tan(x) behavior.  If you 
introduce "better" behavior, then the work somebody else did to ensure 
smoothness of results could be broken.  Then, people will ask "why does 
my algorithm give result x when written in C, but y when written in 
Squeak?".

Hernan Wilkinson wrote:
>
>
>
>     > [...] and if you write 1.3, the object that represents that number
>     > is not going to be an instance of float but of scaledecimal or
>     > fraction or whatever, but not float...
>
>     That only solves the issue of representing literals because:
>
>
>     > and all operations are made with exact representation.
>
>
>
>     cannot be done for all operations: obvious ones like square root, log,
>     sin, etc and less obvious ones like #squared where you run out of
>     enough bits to maintain precision (in fixed-width implementations).
>
>
> not really... root, log, sin, etc could be messages that only inexact 
> numbers know how to answer , so you want "2 sqrt",  do "2 asFloat 
> sqrt", but for +, *, /, etc. they work as expected.
> We can also have better representations for number like pi. Why pi is 
> instance of Float and not Pi? If pi is instance of Pi, then cos(pi/2) 
> = 0 could be true... just a quick hack:
> Pi>>/ aNumber
>
>   ^ Fraction numerator: self denominator: aNumber  "Or maybe an object 
> representing that Pi has been divided/multiplied, etc
>
> Fraction>>cos
>
>  ^ numerator cosDividedWith: denominator
>
> Pi>>cosDividedWith: denominator
>
>  ^denominator = 2 ifTrue: [ 0 ] ifFalse: [ ... ]
>
> and so on
>
>
>
>
>     R
>     -
>
>
>     _______________________________________________
>     Pharo-project mailing list
>     [email protected]
>     <mailto:[email protected]>
>     http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>

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

Reply via email to