We are currently experimenting with floating point numbers and came over a program in Fortran where we weren't able to figure out what happens.
program test
a=0.1
print*, a * .1 * 10.
print*, .1 * a * 10.
print*, .1 * 10. * a
end program test
Question: why does it produce different results?
0.100000009
0.100000009
0.100000001
We think that it could have something to do with the representation model of floating numbers (mantissa, exponent,...) and how the computer rounds numbers, but we are not sure.
Can someone explain how this works in detail?