Java Number Copy Sign copysign(final double x, final double y)

Here you can find the source of copysign(final double x, final double y)

Description

copysign

License

Open Source License

Declaration

public static final double copysign(final double x, final double y) 

Method Source Code

//package com.java2s;

public class Main {
    public static final double copysign(final double x, final double y) {
        //__HI(x) = (__HI(x)&0x7fffffff)|(__HI(y)&0x80000000);
        //return Double.longBitsToDouble((Double.doubleToLongBits(x) & 0x7fffffffffffffffL)|
        //    (Double.doubleToLongBits(y) & 0x8000000000000000L));
        return (y < 0.0D && x > 0.0D) ? -x : ((y > 0.0D && x < 0.0D) ? -x : x);
    }//from ww  w .  j a v  a2  s  .c  om
}

Related

  1. copySign(Double magnitude, Double sign)
  2. copySign(double magnitude, double sign)
  3. copySign(double x, double y)
  4. copySign(final double magnitude, final double sign)
  5. copySign(final double x, final double y)