copysignf.c 196 字节
Newer Older
R
Rich Felker 已提交
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;
}