Summary: | std::fabs is missing from <cstdlib> in 12.1-STABLE for C++17+ | ||
---|---|---|---|
Product: | Base System | Reporter: | Yuri Victorovich <yuri> |
Component: | standards | Assignee: | freebsd-standards (Nobody) <standards> |
Status: | Closed Not A Bug | ||
Severity: | Affects Only Me | CC: | yuripv |
Priority: | --- | ||
Version: | 12.1-STABLE | ||
Hardware: | Any | ||
OS: | Any |
Description
Yuri Victorovich
2020-07-22 18:58:26 UTC
The link you provided says "Defined in header <cmath>", try that? (In reply to Yuri Pankov from comment #1) The link says: Defined in header <cmath> Defined in header <cstdlib> (since C++17) Thank you for pointing this out. I changed the subject. std::fabs is only missing from <cstdlib> for C++17+. > #include <cstdlib> > > int main() { > std::fabs(1.); > } > $ c++ -std=c++17 -o fabs fabs.cpp > fabs.cpp:4:7: error: no member named 'fabs' in namespace 'std' > std::fabs(1.); > ~~~~~^ > 1 error generated. (In reply to Yuri Victorovich from comment #2) Quoting: -------- Defined in header <cmath> Defined in header <cstdlib> (since C++17) float abs( float arg ); double abs( double arg ); long double abs( long double arg ); Defined in header <cmath> float fabs ( float arg ); float fabsf( float arg ); (since C++11) -------- I read it as only abs() being defined in <cstdlib> since c++17, and fabs()/fabsf() having their own preceding comment about being in <cmath>, no? (In reply to Yuri Pankov from comment #3) Ah, I see. My bad, I mis-read it. Thank you for making this clear. Best, Yuri |