The calculation is performed using standard floating point arithmetic on your equipment. Rounding errors sometimes appear.
Do you really need 15 digits of accuracy?
To get a more accurate value, there are several options:
> round(Area). % Will round to integer 6
or you can round to some precision
round(Area * 10000000) / 10000000. 6.0
If the goal is to print the value, then printing with the default output for floats gives you less accuracy.
io:format("~f~n", [Area]). 6.000000 ok
or with a certain accuracy
io:format("~.14f~n", [Area]). 6.00000000000000 ok
NTN
source share