Subnormal floats with mantissas of 7 or less (14 before the previous
fix) have less digits to format than the conversion loop expects,
causing it to never meet the condition to exit and looping forever. This
cannot occur with normal floats because the implicit leading 1 always
produces a sufficiently large value to format.
This causes a hang with the 12 floats closest to zero (26 before the
previous fix) if a suitably large precision is passed (which it is by
default using e.g. `%f`). Fix by exiting the conversion loop if we get
in the case where we can't add any more digits.
Co-authored-by: JasonMDavey <65718912+JasonMDavey@users.noreply.github.com>
Subnormal values were formatted as 1/2 of their true value because it
was assumed the mantissa's significance corresponded to an exponent of
0, not the correct exponent of 1 (which represents 2x the value). Fix by
setting the correct exponent in this case.
This affects the ~16.7 million floats closest to zero.
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.
In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.
AVR-specific places were not changed.
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:
git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'
The 2 commands were done so we don't leave behind spurious spaces.
AVR-specific places were not changed.
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.