On Mon, 2 Oct 2000 09:40:33 -0500, Jarkko Hietaniemi wrote:

>
>For the record: I hate the current policy of defaulting to NVs for
>arithmetic ops.  If I say '2' I do mean an IV of 2, not an NV of
>2.000000000000000.  Currently if I say
>
>  $a = 2;
>  $b = 3;
>  $c = $a + $3;

        s/\$3/\$b/

>the $c will be an NV of of 5.000000000000000, or thereabouts, een
>while $a and $b are IVs.

Note: integers have an exact representation in floating point. There is
no "thereabouts". It is exactly 5.000000000000000.

However, 0.2 + 0.3 is not exactly 0.5, because 0.2 and 0.3 are both
approximations. 0.5 has an exact representation in FP, as has 1/1024.

Since FP calculations on modern processors are at least as fast as
integer calculations, there is hardly any reason to prefer integers to
FP. Bigints, that's another matter.

-- 
        Bart.

Reply via email to