cppreferenceによると、関数acosl
はstd名前空間にある必要があります:https : //en.cppreference.com/w/cpp/numeric/math/acos
ただし、gcc(またはclang)では、以下のコードはコンパイルされません。
#include <cmath>
int main()
{
long double var = std::acosl(4.0);
return 0;
}
次のエラーメッセージが表示されます。
gay@latitude-7490:~$ g++ -std=c++11 test.cpp
test.cpp: In function 'int main()':
test.cpp:5:26: error: 'acosl' is not a member of 'std'; did you mean 'acosh'?
5 | long double truc = std::acosl( (long double)4.0);
| ^~~~~
| acosh
何が欠けていますか?cppreferenceを誤解していますか?
GCCのどのバージョンですか?うーん、GCC 4.9.2で
—
CoryKramer
@CoryKramer 9.2とtruncが失敗します。成功
—
Ted Lyngmo
acosl
せずstd::
。
私は何が起こっているのかわからないんだけど、両方
—
HolyBlackCat
acosl(4.0)
とstd::acos(4.0l)
仕事をします。また、追加-stdlib=libc++
するstd::acosl(4.0)
とClangで機能します。