C++ math functions not available in namespace std
Jan.Sommer at dlr.de
Jan.Sommer at dlr.de
Wed Jan 11 14:46:09 UTC 2023
Ah, thanks for the clarification.
If I can be of any help with the porting, let me know.
From: Joel Sherrill <joel at rtems.org>
Sent: Mittwoch, 11. Januar 2023 14:08
To: Sommer, Jan <Jan.Sommer at dlr.de>
Cc: rtems-users at rtems.org <users at rtems.org>
Subject: Re: C++ math functions not available in namespace std
This happens on the architectures where size of long double is not the same as double. The header file disables everything if any math method is missing.
I have it on my list to address. I was porting the long double methods from FreeBSD before anyone ran into this but haven't finished
On Wed, Jan 11, 2023, 3:43 AM <Jan.Sommer at dlr.de<mailto:Jan.Sommer at dlr.de>> wrote:
Hello and happy New Year,
I stumbled upon a slightly weird problem with the current cross-compilers.
According to https://en.cppreference.com/w/cpp/numeric/math/fmax std::fmax should be part of <cmath> for >= C++11.
However, if I try to use it, I sometimes get "error: 'fmax' is not a member of 'std'; did you mean 'max'?"
I do get the error when compiling the test file (see below) with i386-rtems6-g++ and riscv-rtems6-g++, but for example not for arm-rtems6-g++.
If I use "fmax" instead of "std::fmax" the file compiles for all 3 architectures.
However, I have a library which uses the math functions with the namespace qualifier, which I cannot change that easily.
Does someone know, what is the reason for that behavior (I guess it's related to newlib?) and what a solution could look like?
Best regards,
Jan
PS: My test file looks like this:
#include <cmath>
double test(double a, double b)
{
return std::fmax(a, b);
}
_______________________________________________
users mailing list
users at rtems.org<mailto:users at rtems.org>
http://lists.rtems.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20230111/d2512dbf/attachment.htm>
More information about the users
mailing list