public static float copySign(final float magnitude,final float sign){
  return Float.intBitsToFloat(Float.floatToRawIntBits(sign) & Integer.MIN_VALUE | Float.floatToRawIntBits(magnitude) & Integer.MAX_VALUE);
}

public static float copySign ( final float magnitude , final float sign ) { return Float . intBitsToFloat ( Float . floatToRawIntBits ( sign ) & Integer . MIN_VALUE | Float . floatToRawIntBits ( magnitude ) & Integer . MAX_VALUE ) ; }
a sign of nan can be interpreted as positive or negative .
