8

can we just get rid of floating points? or at least make it quite clear that they are almost certainly not to be used.

yes, they have some interesting properties that make them good for special tasks like raytracing and very special forms of math. but for most stuff, storing as much smaller increments and dividing at the end (ie. don't store money as 23.45. store as 2,345. the math is the same. implement display logic when showing it.) works for almost all tasks.

floating point math is broken! and most people who really, truely actually need it can explain why, which bits do what, and how to avoid rounding errors or why they are not significant to their task.

or better yet can we design a standard complex number system to handle repeating divisions and then it won't be an issue?

footnote: (I may not be perfectly accurate here. please correct if you know more)

much like 1/3 (0.3333333...) in base 10 repeats forever, that happens with 0.1 in base 2 because of how floats store things.
this, among other reasons, is why 0.1+0.2 returns 0.30000004

Comments
  • 1
  • 3
    Lemme do a quick background check aaaaaaaand yeah, i wouldnt want you using floats either
  • 0
    @ganjaman neither do I. that's why I don't. and I have had zero heartache about it. and I will continue to not use floats. and life is better for it.
  • 1
    First, if someone uses floating point for money, they must be pretty clueless. Second, regarding the complex number thing, Common LISP has built in support for fractions (called "rationals") e.g. 1/3 is a number like any else and can be used in operations normally. Just letting you know 😛
  • 0
    @Teabagging4Life that's awesome. maybe I will give lisp a shot. but it would be nice to have said support at either a hardware level or in STD C libraries that could be linked to by any language. but I'm gonna look into that because it sounds awesome.
  • 1
    If you're using floats for currency calculations, you're gonna have a bad time
Add Comment