-2

I'm trying to do the following calculation: 28860.000000001 - 28800 = 60.000000001

However Go gives me 60.000000001000444

a := float64(28860.000000001)
b := float64(28800)
expected := float64(60.000000001)
answer := a - b

What am I doing wrong here?

Tobias Artz
  • 87
  • 1
  • 8
  • 2
    Possible duplicate of [Is floating point math broken?](http://stackoverflow.com/questions/588004/is-floating-point-math-broken) – Willian Dec 14 '15 at 04:07

1 Answers1

0

Turns out this inherit with floats. Read more here: http://floating-point-gui.de/

Tobias Artz
  • 87
  • 1
  • 8