1#include <math.h> 2#include <stdint.h> 3 4float copysignf(float x, float y) { 5 union { 6 float f; 7 uint32_t i; 8 } ux = {x}, uy = {y}; 9 ux.i &= 0x7fffffff; 10 ux.i |= uy.i & 0x80000000; 11 return ux.f; 12} 13