|
|
@ -67,6 +67,14 @@ public class PrismUtils |
|
|
return Math.log(x) / Math.log(2); |
|
|
return Math.log(x) / Math.log(2); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Compute the number of bits needed to encode n different values. |
|
|
|
|
|
*/ |
|
|
|
|
|
public static int bitsForEncoding(int n) |
|
|
|
|
|
{ |
|
|
|
|
|
return (int) Math.ceil(PrismUtils.log2(n)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* See if two doubles are within epsilon of each other (absolute error). |
|
|
* See if two doubles are within epsilon of each other (absolute error). |
|
|
*/ |
|
|
*/ |
|
|
|