Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
bahua129047yEvery language has tools for rounding these numbers back to as many decimal places as you want. I don't understand the recent rage about floating point numbers.
-
Maroti6737y@bahua, well, you see, my younger self didn't consider rounding off important for adding and subtracting 0.05 from whole numbers..
Also I don't think I can blame my younger self for expecting things to simply work .. -
Floating point arithmetic... is good enough for the job it does combined with its efficiency. Arbitrary accuracy comes with additional cost. If you want absolute accuracy, floating point numbers are not what you want.
-
Maroti6737yRealized it late, my code failed at (x.02 == x.01999...) on new hardware.. (with x being less than 50)
Also all increments were of 0.01 size..
I only checked here after I had already spent days looking elsewhere in my code..
@Teabagging4Life I don't know what to think now.. -
@Proximyst
Do Rust and Kotlin use different float types? Or how do they solve it then? -
@ColonelPhantom Nope, but Rust has for me just worked great, and in Kotlin I use Strictfp where it fits
Related Rants
-
rephiscorth38Everyone here ranting about a fucking missing semicolon. I can't remember the last time a missing semicolon wa...
-
CodesNotHot10-Laughed at Gitlab the other day -Accidentally dropped my db today. fuck karma
-
codeclod15When you have a super annoying problem that Google has been unable to help with... But you stumble upon a link...
Fuck floating point inaccuracy.
Genuinely fuck it.
rant
float
fuck this shit
fuck
decimal
floating point math