blob: 76d2d255dcf828fdd8aa9839312f476377ff0f20 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <math.h>
#include <stdint.h>
float copysignf(float x, float y)
{
// XXX EMSCRIPTEN: use the wasm instruction via clang builtin
// See https://github.com/emscripten-core/emscripten/issues/9236
#ifdef __wasm__
return __builtin_copysignf(x, y);
#else
union {float f; uint32_t i;} ux={x}, uy={y};
ux.i &= 0x7fffffff;
ux.i |= uy.i & 0x80000000;
return ux.f;
#endif
}
|