public static final double scalb(double x,int n){
  int k, hx, lx;
  hx=(int)(Double.doubleToLongBits(x) >>> HI_SHIFT);
  lx=(int)(Double.doubleToLongBits(x) & LO_MASK);
  k=(hx & 0x7ff00000) >> 20;
  if (k == 0) {
    if ((lx | (hx & 0x7fffffff)) == 0) {
      return x;
    }
    x*=two54;
    hx=(int)(Double.doubleToLongBits(x) >>> HI_SHIFT);
    k=((hx & 0x7ff00000) >> 20) - 54;
    if (n < -50000) {
      return tiny * x;
    }
  }
  if (k == 0x7ff) {
    return x + x;
  }
  k=k + n;
  if (k > 0x7fe) {
    return huge * copySign(huge,x);
  }
  if (k > 0) {
    x=Double.longBitsToDouble(((long)((int)(hx & 0x800fffff) | (k << 20)) << HI_SHIFT) | (Double.doubleToLongBits(x) & LO_MASK));
    return x;
  }
  if (k <= -54) {
    if (n > 50000) {
      return huge * copySign(huge,x);
    }
 else {
      return tiny * copySign(tiny,x);
    }
  }
  k+=54;
  x=Double.longBitsToDouble(((long)((int)(hx & 0x800fffff) | (k << 20)) << HI_SHIFT) | (Double.doubleToLongBits(x) & LO_MASK));
  return x * twom54;
}

public static final double scalb ( double x , int n ) { int k , hx , lx ; hx = ( int ) ( Double . doubleToLongBits ( x ) > > > HI_SHIFT ) ; lx = ( int ) ( Double . doubleToLongBits ( x ) & LO_MASK ) ; k = ( hx & 0x7ff00000 ) > > 20 ; if ( k == 0 ) { if ( ( lx | ( hx & 0x7fffffff ) ) == 0 ) { return x ; } x *= two54 ; hx = ( int ) ( Double . doubleToLongBits ( x ) > > > HI_SHIFT ) ; k = ( ( hx & 0x7ff00000 ) > > 20 ) - 54 ; if ( n < - 50000 ) { return tiny * x ; } } if ( k == 0x7ff ) { return x + x ; } k = k + n ; if ( k > 0x7fe ) { return huge * copySign ( huge , x ) ; } if ( k > 0 ) { x = Double . longBitsToDouble ( ( ( long ) ( ( int ) ( hx & 0x800fffff ) | ( k << 20 ) ) << HI_SHIFT ) | ( Double . doubleToLongBits ( x ) & LO_MASK ) ) ; return x ; } if ( k <= - 54 ) { if ( n > 50000 ) { return huge * copySign ( huge , x ) ; } else { return tiny * copySign ( tiny , x ) ; } } k += 54 ; x = Double . longBitsToDouble ( ( ( long ) ( ( int ) ( hx & 0x800fffff ) | ( k << 20 ) ) << HI_SHIFT ) | ( Double . doubleToLongBits ( x ) & LO_MASK ) ) ; return x * twom54 ; }
scalbn ( double x , int n ) scalbn ( x , n ) returns x * 2 * * n computed by exponent manipulation rather than by actually performing an exponentiation or a multiplication .
