Browse Source

imported patch sample-PrismUtils-bitsForEncoding.patch

accumulation-v4.7
Joachim Klein 7 years ago
committed by Joachim Klein
parent
commit
916c7e3f90
  1. 8
      prism/src/prism/PrismUtils.java

8
prism/src/prism/PrismUtils.java

@ -70,6 +70,14 @@ public class PrismUtils
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).
*/

Loading…
Cancel
Save