Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Don't use obsolete math implementations by default
Enabling the old math code removes some useful functions from the library, uses some stale code and generally isn't a good plan. The new math code requires newer compiler features (post 1999). Signed-off-by: Keith Packard <keithp@keithp.com>
- Loading branch information
f09de59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new math uses doubles internally for float functions (eg
sinf()
).This pulls in double arithmetic code increasing flash usage by ~3k at my project.
Would you mind making this an configuration option?
f09de59
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't look at the math code closely enough to understand all of the differences that this option controlled.
I've fixed a bug in the code used by __OBSOLETE_MATH in sf_log1p.c so that it doesn't pull in double precision __math_divzero and __math_invalid functions.
Then, I reverted the __OBSOLETE_MATH_DEFAULT value back to 1.
Finally, I added a new configuration option 'newlib-obsolete-math', which you can set to 'true' to force
obsolete math, or leave at 'auto', which will use the default value of 1.
I've tested by linking essentially every math function into an application and verifying that no double precision routines were linked. That, sadly, also requires removing floating point printf support as that can only use doubles due to C calling convention. So, anything printing double values will still haul in all of the double math functions.