Next code gives me 5.999999999999998 in Result, but right answer is 6.
Alpha = math:acos((4*4 + 5*5 - 3*3) / (2*4*5)) Area = 1/2 * 4 * 5 * math:sin(Alpha)
Is it possible to get 6?
The calculation is done using standard floating point arithmetic on your hardware. Sometimes rounding errors show up.
Do you really need 15 digits of precision?
To get a more "exact" value there are multiple options:
or you could round to some precision
If the purpose is to print the value, then printing with the default output for floats give you less precision.
or with a specific precision