Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix double promotion warnings #56

Merged
merged 8 commits into from
Dec 13, 2023

Conversation

XenuIsWatching
Copy link
Member

@XenuIsWatching XenuIsWatching commented Dec 10, 2023

This fixes the double promotion warnings when compiling with -Wdouble-promotion

see: zephyrproject-rtos/zephyr#57154

When CONFIG_ZSL_SINGLE_PRECISION is not set. All floats get promoted
to doubles. This causes warnings with -Wdouble-promotion.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Float and Double were swapped for their tests. `I` is a single
percision constant so cast to double.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Set the compilier flag for gcc or armclang to force constants to be
single percision.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
With CONFIG_ZSL_SINGLE_PRECISION, have all constants be single
percision.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
With Wdouble-promotions, cast float params in printf to double.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
The double math library functions where being used in the case
for single percision. Use the macros defined in zsl.h for either
single or double math library functions.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
@XenuIsWatching XenuIsWatching force-pushed the fix-single branch 2 times, most recently from 177dc1b to 0d44b9b Compare December 12, 2023 09:42
some tests were failing due to being just slighty outside the
eps for single percision. Increase it a bit to pass the test
case.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
zsl_phy_atom_bohr_orb_radius does not work with single percision
as numbers to small get multipled and just become 0.0f. Multiple
a large constant in to the numerator and denomerator to prevent
numbers from getting to small.

Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
Copy link
Member

@microbuilder microbuilder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes.

@microbuilder microbuilder merged commit a4bb6cf into zephyrproject-rtos:master Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants