[erlang-questions] floating point exception when accuracy exceeds limit
Erik Søe Sørensen
eriksoe@REDACTED
Tue Jan 20 12:10:42 CET 2015
What exactly do you mean by "accuracy"?
In very few applications would it "be better" to get an answer which is
orders of magnitude from the correct result, which is what you'd likely get
if you handled all overflows with "use the maximum representable value".
(For a better version of "No", wait till the sun reaches NZ; O'Keefe
usually has something eloquent to say then. :-))
/Erik
Den 20/01/2015 11.49 skrev "Johan Montelius" <johanmon@REDACTED>:
>
> This might be no news to anyone who is doing a lot of floating point
> arithmetics but it made me scratch my head.
>
>
> 7> (6.0e150*6.0e150).
> 3.6000000000000004e301
>
> 8> (6.0e154*6.0e154).
> ** exception error: an error occurred when evaluating an arithmetic
> expression
> in operator */2
> called as 6.0e154 * 6.0e154
>
>
> Hmm, would it not be better to answer with the highest possible accuracy?
>
> Johan
>
>
> --
> Assoc. Prof. Johan Montelius
> Software and Computer Systems
> School of Information and Communication Technology
> KTH - Royal Institute of Technology
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150120/6da71556/attachment.htm>
More information about the erlang-questions
mailing list