Closed dmik closed 3 years ago
std::nearbyint is a modern rounding function in C++.
std::nearbyint
This following program:
#include <iostream> #include <cmath> int main() { double d1 = 127.00000; std::cout << d1 << ' ' << std::nearbyint(d1) << '\n'; return 0; }
outputs 127 nan instead of 127 127 for some reason.
127 nan
127 127
Note that any other double instead of 127 results in nan as well.
nan
Spotted here: https://github.com/bitwiseworks/qtwebengine-chromium-os2/issues/21#issuecomment-691239455.
Well, C++ just forwards these calls to libc, so it should be fixed there. Created https://github.com/bitwiseworks/libc/issues/87 and will close this one.
I spotted another problem though. An attempt to include fails with multiple errors. Created #31 for it.
std::nearbyint
is a modern rounding function in C++.This following program:
outputs
127 nan
instead of127 127
for some reason.Note that any other double instead of 127 results in
nan
as well.Spotted here: https://github.com/bitwiseworks/qtwebengine-chromium-os2/issues/21#issuecomment-691239455.