jeudi 3 janvier 2019

Is fabsf part of the std namespace in C++11?

The page https://en.cppreference.com/w/cpp/numeric/math/fabs mentions that std::fabsf is available since C++11. However, when I use G++ 6.3.0 to compile even the simplest program that uses std::fabsf, it says that fabsf is not a member of std.

#include <cmath>
int main()
{
    return (int)std::fabsf(0.0f);
}

Which one is right? Is G++ 6.3.0 wrong in not including it in std, or is the above page wrong in mentioning it as part of std?

And if it's G++ that is wrong, is that fixed in later versions?

Aucun commentaire:

Enregistrer un commentaire