[erlang-questions] Float multiplication behaviours

Michael Turner <>
Tue Apr 24 10:24:02 CEST 2012


The first computer I ever programmed was an HP-2000B running a dialect
of Dartmouth BASIC. IIRC, in certain instances, its floating point
results could be off by over 5%. William Kahan, numerical analyst and
co-architect of the IEEE floating point standard, was still seen
hitting the ceiling in the late 70s over computing products from H-P
that exhibited wild divergence from common sense (not to mention the
subtler sources of error that drove numerics folk batty, back in the
days before standardized floating point.)

Against this historical background, perhaps one ought to be grateful
when floating point appears to diverge from common sense by only one
part in ten trillion.

Decimal fixed-point arithmetic still has a place, though, I'm sure.
Currency calculations, for example.

-michael turner


On Tue, Apr 24, 2012 at 2:46 AM, Steve Vinoski <> wrote:
> On Mon, Apr 23, 2012 at 1:37 PM, Juan Puig
> <> wrote:
>> Hello there,
>>
>> we are running Erlang R15B (erts-5.9). Any fact that could demonstrate the following behaviour?
>>
>> ()51> 1.20*100.
>> 120.0
>> ()49> 10.20*100.
>> 1019.9999999999999
>> ()50> 100.20*100.
>> 10020.0
>
> http://floating-point-gui.de/
>
> --steve
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list