boredcodebyk / mintcalc

A simple calculator and unit converter app with Material Design 3 inspired by Windows Calculator
GNU General Public License v3.0
62 stars 4 forks source link

addition error #12

Open nyx717 opened 1 year ago

nyx717 commented 1 year ago

6.51 + 1.47 = 7.9799999999999995

???

sosauce commented 6 months ago

That's caused by floating point numbers loosing precision and has always been a thing in computer science 😉

See this: https://en.wikipedia.org/wiki/IEEE_754#Rounding_rules