News for hackers. Stuff that matters.
Re:Why floats suck - accurate galaxy-wide coordinates in 128... by aidenn0 on Monday May 02, 2011 @03:36PM (#2507515)
This article understands how floating point works.

People using floating point often have a fundamental lack of understanding how floating point works. Floating point numbers are a leaky abstraction that exist only for performance optimization. Using floats as a default is an example of premature optimization.

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by cdavid on Monday May 02, 2011 @07:58PM (#2508416)
Floating point do not exist for performance optimization - they were much slower than fixed points at first (not anymore on general purpose CPU). The point of floating point is to have the same accuracy (number of meaningful digits) independently of its amplitude, but that means that their precision is indeed not uniform (near 1, 64 bits float has a precision of ~ 1e-16, near 100000, near 1e-11, etc...).

In that sense, saying that floating point suck shows a lack of knowledge about them, since the observed behavior by the OP is exactly what they have been designed for. If you want the same precision independently of the amplitude, then indeed fixed point may be what you want. But you have to keep in mind that it will give you a lot of other issues as well.

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by sharpneli on Monday May 02, 2011 @06:19PM (#2508146)
Also people writing floating point off because it does not fit well into situations where you have evenly divide something (e.g galaxy into picometer sized voxels) show fundamental lack of understanding how floating point works. One of the biggest reasons floats are used is that error propagation is much better when floats are used in many numerical algorithms.

In a nutshell. If you want coordinates in galaxy use fixed point (or in game level). If you want to calculate values of hyperbolic trigonometric functions or whatever use floats.

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by eru on Monday May 02, 2011 @06:17PM (#2508139)
The default should be rationals or even algebraic numbers?