MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / pow2

Method pow2

JSAT/src/jsat/math/FastMath.java:117–124  ·  view source on GitHub ↗

Computes 2 x exactly be exploiting the IEEE format @param x the integer power to raise 2 too @return 2 x

(int x)

Source from the content-addressed store, hash-verified

115 * @return 2<sup>x</sup>
116 */
117 public static double pow2(int x)
118 {
119 if(x > Double.MAX_EXPONENT)
120 return Double.POSITIVE_INFINITY;
121 if(x < Double.MIN_EXPONENT)
122 return 0;
123 return longBitsToDouble((x+1023L)<<52);
124 }
125
126 /**
127 * Computes 2<sup>x</sup>.<br>

Callers 5

testPow2_intMethod · 0.95
testPow2_doubleMethod · 0.95
perpMethod · 0.95
powMethod · 0.95
expMethod · 0.95

Calls

no outgoing calls

Tested by 2

testPow2_intMethod · 0.76
testPow2_doubleMethod · 0.76