4 ms·
> 1,056,964,610. There are 4,294,967,296 possible 32-bit words, so about a quarter of them are in the interval [0,1]. Isn’t that interesting? Of all the float-p
by dr_dshiv 4y ago
> 1,056,964,610. There are 4,294,967,296 possible 32-bit words, so about a quarter of them are in the interval [0,1]. Isn’t that interesting? Of all the float-pointing point numbers your computer can represent, a quarter of them lie in [0,1]. By extension, half of the floating-point numbers are in the interval [-1,1].
- Taywee 4y agoI don't think it's that strange. It's a scientific notation with the signed exponent around 0, so (barring special cases like NaN and infinite), it will be divided roughly in half around the pivot of 2^0 for both signs.
- magicalhippo 4y agoSurely this was by design? At least when solving physics problems, you'll frequently scale the equations so the actual values in the problem are around -1..1. Thus having extra precision around -1..1 when solving such problems would be beneficial. For example, if you're trying to solve the motion of a mass on a spring that gets an initial kick, rather than representing the spring length in meters, you divide by some characteristic length[1] and get a non-dimensional length of order 1. If you want the actual length, you just multiply the non-dimensional length by the characteristic length. [1]: https://hplgit.github.io/scaling-book/doc/pub/book/html/._scaling-book2006.html https://hplgit.github.io/scaling-book/doc/pub/book/html/._sc...
- moralestapia 4y ago>Surely this was by design? It is indeed, and one of the first things you learn in scientific computing is to make your values fit mostly within [-1, 1].
- sampo 4y ago> Thus having extra precision around -1..1 when solving such problems would be beneficial. Floating point numbers have the same precision (relative precision) everywhere.
- deleted 4y ago[deleted]
- skellington 4y agoYeah it can be hard to internalize what this means and when it matters, but basically you get about 7 decimal places of precision regardless of the numbers size. So between [-1, 1] you can represent a number like 0.1234567 and then 0.1234568 for a min delta of 0.000001. But around a billion, you can only represent 1,234,567,000 and then 1,234,568,000 for a min delta of 1000. These are not exactly right numbers, just rough estimates to get the idea, but the point is if you are trying to do something like add 1 centimeter to a position that is 10,000 kilometers from an origin, you're adding 0, no matter how many times you do it, it will never increment.
- magicalhippo 4y agoRight, but my point is that you scale the physics problems because it makes them more general. In my example, if you changed the length of the spring you don't have to recalculate the whole solution, you just calculate the new characteristic length for your new spring length and "undo" the scaling with this new characteristic length using the previously computed solution. Thus, since you know a lot of problems will have values around order 1 it makes sense to design the encoding such that you get extra absolute precision for order 1 numbers.
- EdSchouten 4y agoSomewhat desirable, as it means you can get the reciprocal of any number without a loss of precision, right?