mpaland / printf

Tiny, fast, non-dependent and fully loaded printf implementation for embedded systems. Extensive test suite passing.
MIT License
2.54k stars 464 forks source link

Proper handling of denormals #119

Open eyalroz opened 3 years ago

eyalroz commented 3 years ago

Denormal, or subnormal, floating-point numbers are those with an exponent of zero. Their implicit leading mantissa bit is 0, so one needs to look at their mantissa to determine their "true" exponent. And since printf()-like functions are required by the standard to print non-zero de-normals with a non-zero integral part before the decimal point - they must determine the true exponent.

This library doesn't do so. The worst case of this behavior is with 0.0 and -0.0: That's issue #54 . This is about properly handling all denormals (and covering their handling by some testcases).