[erlang-questions] : Strange arithmetic behaviour

Raimo Niskanen raimo+erlang-questions@REDACTED
Thu May 8 12:11:40 CEST 2008


On Thu, May 08, 2008 at 02:40:12PM +0500, Gurgen Tumanian wrote:
> I did expect this kind of behaviour from C, since the values i did
> experiment with were  out of the C float range. However I did expect that
> erlang could handle this in some meaningfull way. It does handle big
> integers that are over the C int range, doesn't it?

Sorry to disappoint you.

Integers are infinite size (almost), but floats are IEEE 64 bit.

Suppose you had arbitrary precision floats and did
	1.0 / 3.0
Then you could not store the result because there
is no exact result in base 2.

So you would have to give a rounding strategy for
every division, or have an implicit. And that would
probable be stranger than IEEE floats. But interesting.

And I would not want to write the library that does e.g
sin, cos, tan, asin, acos, atan, pow, exp, erf
for a given arbitrary rounding strategy.
Someone else?

> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 

/ Raimo Niskanen, Erlang/OTP, Ericsson AB



More information about the erlang-questions mailing list