[Pharo-project] Unexpected behavior of roundTo:

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Fri Apr 8 22:05:30 CEST 2011


2011/4/8 Marcus Denker <marcus.denker at inria.fr>:
>
> On Apr 8, 2011, at 7:48 PM, Hilaire Fernandes wrote:
>
>> Well, whatever the underneath representation, one can expect roundedTo:
>> 2 to return a float with two decimals.
>>
> Sometimes I think we should use the resources that these amazing machines
> give us these days to move programming languages closer to humans...
>
> There are better Float models than the ones that are implemented in hardware.
> E.g. another INRIA Project is this GNU MPFR:
>
> "The MPFR library is a C library for multiple-precision floating-point computations with correct rounding."
>
>        http://www.mpfr.org/
>
> Why don't we make our language better at "real" math? The power in the machine is definitly there...
> I am quite convincd that if there are normal programming languages in 50 years, the math part of them
> will be closer to Mathematica then to C...
>
>        Marcus
>
>

mpfr are still floating point with inexact operations, you just change
the precision to whatever number of bits you want.

I played with my own modest Smalltalk implementation relying on
LargeInteger arithmetic
http://www.squeaksource.com/ArbitraryPrecisionFl.html
It implements correct rounding to (if correct is round to nearest even).

Nicolas

>
>
>
> --
> Marcus Denker  -- http://www.marcusdenker.de
> INRIA Lille -- Nord Europe. Team RMoD.
>
>
>



More information about the Pharo-project mailing list