aboutsummaryrefslogtreecommitdiff
path: root/src/math/copysignf.c
blob: c4122c8e64e144ba75b9a6c8d12ded7ff752ab7c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <math.h>
#include <stdint.h>

float copysignf(float x, float y)
{
	union {float f; uint32_t i;} ux={x}, uy={y};
	ux.i &= 0x7fffffff;
	ux.i |= uy.i & 0x80000000;
	return ux.f;
}


#ifdef TEST
int
main(void) {
	return 0;
}
#endif