c++ - Emscripten error when compiling double comparison function 'IsAlmostEqual' -
i'm novice in using emscripten , encountered error in compiling cpp file.
i have iae.cpp:
bool isalmostequal(double a, double b) { //http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm long long aint = reinterpret_cast<long long&>(a); if (aint < 0) aint = -9223372036854775808ll - aint; long long bint = reinterpret_cast<long long&>(b); if (bint < 0) bint = -9223372036854775808ll - bint; return (std::abs(aint - bint) <= 10000); }
i tried compile using emscripten:
emcc iae.cpp
but generates following warnings , errors:
info root: (emscripten: running sanity checks) warning root: java not seem exist, required closure compiler. -o2 , above fail. need define java in ~/.emscripten iae.cpp:5:27: warning: integer constant large unsigned if (aint < 0) aint = -9223372036854775808ll - aint; ^ iae.cpp:7:27: warning: integer constant large unsigned if (bint < 0) bint = -9223372036854775808ll - bint; ^ iae.cpp:8:13: error: use of undeclared identifier 'std' return (std::abs(aint - bint) <= 10000); ^ 2 warnings , 1 error generated. error root: compiler frontend failed generate llvm bitcode, halting
how rid of these warnings , errors , possible compile isalmostequal()
using emscripten?
seems you
- missed include
<cstdlib>
- try use 64 bit value, not natively supported javascript. can @ expense of performance. read https://github.com/kripken/emscripten/wiki/codeguidelinesandlimitations guidance.
Comments
Post a Comment