Why does 0.1 0.2 = 0.30000000000000004?

I realized that I didn’t understand exactly how it worked. I mean, I know floating point calculations are inexact, and I know that you can’t exactly represent 0.1 in binary, but: there’s a floating point number that’s closer to 0.3 than 0.30000000000000004! So why do we get the answer 0.30000000000000004?.
Why does 0.1 0.2 = 0.30000000000000004? #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/why-does-0-1-0-2-0-30000000000000004

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles