diff options
Diffstat (limited to 'src/math/copysignf.c')
-rw-r--r-- | src/math/copysignf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/math/copysignf.c b/src/math/copysignf.c new file mode 100644 index 00000000..47ab37e4 --- /dev/null +++ b/src/math/copysignf.c @@ -0,0 +1,11 @@ +#include "libm.h" + +float copysignf(float x, float y) { + union fshape ux, uy; + + ux.value = x; + uy.value = y; + ux.bits &= (uint32_t)-1>>1; + ux.bits |= uy.bits & (uint32_t)1<<31; + return ux.value; +} |