3 ms·
> Sorting can be handled by putting the exponent before the mantissa. Don't denormal numbers prevent simply sorting this way? I could use a diagram like the OP
by kibwen 9y ago
> Sorting can be handled by putting the exponent before the mantissa.
Don't denormal numbers prevent simply sorting this way? I could use a diagram like the OP's to remind myself how they work...
- thethirdone 9y ago> Don't denormal numbers prevent simply sorting this way? I could use a diagram like the OP's to remind myself how they work... No, there is nothing really special about subnormal numbers other than that they have a smaller than normal precision. For example 0x00000001 < 0x00400000 in both floating point and normal integer arithmetic. The only weird bit about sorting floats as integers is that the order is reversed; eg -0f is represented by the smallest integer (0x80000000) and -Inf is represented by 0xFF800000.
- cesarb 9y agoUsing the article's "window" analogy: denormals are in the smallest "window", so the sort order between the "windows" (exponents) is kept. Their special property is that they don't have the implicit one to the left of the point (it's an implicit zero instead); the order within the mantissa is still kept. That is: 0 000000 0100010101010111 ± exp. mantissa Here, the value is 0.0100010101010111₂ × 2^-30 (I hope I calculated the exponent correctly) As a bonus, the zero value comes naturally in this approach: it's a denormal with a mantissa of zero. Without denormals, the implicit one would get in the way.