24
Maroti
7y

Fuck floating point inaccuracy.
Genuinely fuck it.

Comments
  • 4
    Gonna fuck it hard too.
  • 4
    Never had an issue of this in Rust or Kotlin :)
  • 0
    Every 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.
  • 1
    @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 ..
  • 0
    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.
  • 0
    Realized 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..
  • 1
    @Proximyst
    Do Rust and Kotlin use different float types? Or how do they solve it then?
  • 2
    @ColonelPhantom Nope, but Rust has for me just worked great, and in Kotlin I use Strictfp where it fits
Add Comment