[erlang-questions] Maths Problem -> 2452.45*100. = 245244.99999999997

Bohuslav Svancara bsvancara@REDACTED
Wed Nov 27 17:13:22 CET 2013

>>Unfortunately, decimal does not solves all problems.

I do not want to be sarcastic, but it is really hard to divide 100 dollars
between three guys,
give them all the same amount (100/3) and then say "Sorry, I need my money
Do you think you will have 100 dollars then?

You need to decide what precision is right for you (specifically when you
ared dividing), how to correctly round and so on. There is a whole
mathematics about it.

You need to determine needed precision.
Sometimes the value 3.14 is good, but sometimes the value
3,14159265358979323846 is not good enough...

Decimals do solve problems if you know needed precision.

In financials you need to calculate millions and billions with a precision
to cents.

And - for example - for US Debt ( http://www.usdebtclock.org/ ) you need 16
digits (trillions) if you want to be accurate to cents right now. :-)
Imagine to express US Debt in Japanese Yen :-)


2013/11/27 Anthony Ramine <n.oxyde@REDACTED>

> This looks like a bug in decimal though, this time.
> --
> Anthony Ramine
> Le 27 nov. 2013 à 14:37, Alexander Alexeev <mail@REDACTED> a écrit :
> > Unfortunately, decimal does not solves all problems.
> _______________________________________________
> 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/20131127/86194694/attachment.htm>

More information about the erlang-questions mailing list