News for hackers. Stuff that matters.
Re:Why floats suck - accurate galaxy-wide coordinates in 128... by smlacy on Monday May 02, 2011 @04:22PM (#2507667)
Floats are for math. Math includes computing things like 100! (100 factorial), the volume of the observable universe (~3.3* 10^80), or any other countably finite value, most of which are far greater than 2^128.

Fixed point is a special purpose encoding that is useful in many places (computer graphics and constrained simulations) when your range and precision are known and fixed. "Math" doesn't follow these rules.

Floats are good for math.

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by JabavuAdams on Monday May 02, 2011 @08:21PM (#2508469)
You have it exactly backwards. 100 factorial cannot be represented by a float (or double, or long double)

100! = 9332621544394415268169923885626670049071596826438162146859296389521759\ 9993229915608941463976156518286253697920827223758251185210916864000000\ 000000000000000000

This is 2^(524.765) > 2^32 or 2^64 or 2^80 or 2^128

Note that "floating point" is commonly used to refer to 32-bit or 64-bit or 80-bit representations.

Floats are for games (with caveats), and possibly engineering, while purer math needs arbitrary-precision representations that are too slow for games and many simulations.

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by brazzy on Tuesday May 03, 2011 @05:04AM (#2509411)
Floats are primarily designed for engineering, and not just floats. Read the original von Neumann paper. Basically, out dominant computer architectur was originally designed to optimally support floating-point for numerical calculations.

EDIT: I just looked at the paper again and realize that I was wrong. Von Neumann actually wanted to keep things simple and thus assumed all numbers to be normalized to be between -1 and 1...

Re:Why floats suck - accurate galaxy-wide coordinates in 128... by eru on Monday May 02, 2011 @06:13PM (#2508125)
And I thought arbitrary precision integers and rational numbers were for mathematics.