about summary refs log tree commit diff
path: root/src/math/copysignf.c
blob: 47ab37e44e5845e947f5e4209726b5c302a0d850 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
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;
}