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

AP_Math: correct warning on fabsF #27792

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

peterbarker
Copy link
Contributor

This is a bit weird, actually.

Surely this is true of the trig functions in here too. When we explicitly instantiate Vector3<double> and we're using 32-bit maths we'll use the float versions of the trig functions when determining angles and whatnot for that instantiation?

2024-08-08T01:51:53.6780446Z ../../libraries/AP_Math/vector3.cpp:432:9: warning: absolute value function 'fabsf' given an argument of type 'const double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value]
2024-08-08T01:51:53.6781336Z     if (fabsF(cosv) >= 1) {
2024-08-08T01:51:53.6781583Z         ^
2024-08-08T01:51:53.6781930Z ../../libraries/AP_Math/ftype.h:50:18: note: expanded from macro 'fabsF'
2024-08-08T01:51:53.6782342Z #define fabsF(x) fabsf(x)
2024-08-08T01:51:53.6782572Z                  ^
2024-08-08T01:51:53.6789178Z ../../libraries/AP_Math/vector3.cpp:633:16: note: in instantiation of member function 'Vector3<double>::angle' requested here
2024-08-08T01:51:53.6789800Z template class Vector3<double>;

2024-08-08T01:51:53.6780446Z ../../libraries/AP_Math/vector3.cpp:432:9: warning: absolute value function 'fabsf' given an argument of type 'const double' but has parameter of type 'float' which may cause truncation of value [-Wabsolute-value]
2024-08-08T01:51:53.6781336Z     if (fabsF(cosv) >= 1) {
2024-08-08T01:51:53.6781583Z         ^
2024-08-08T01:51:53.6781930Z ../../libraries/AP_Math/ftype.h:50:18: note: expanded from macro 'fabsF'
2024-08-08T01:51:53.6782342Z #define fabsF(x) fabsf(x)
2024-08-08T01:51:53.6782572Z                  ^
2024-08-08T01:51:53.6789178Z ../../libraries/AP_Math/vector3.cpp:633:16: note: in instantiation of member function 'Vector3<double>::angle' requested here
2024-08-08T01:51:53.6789800Z template class Vector3<double>;
@tridge tridge merged commit 6c788c6 into ArduPilot:master Aug 13, 2024
93 checks passed
@peterbarker peterbarker deleted the pr/fabsf-warning-fix branch August 13, 2024 00:50
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.

4 participants