Class JMSLMath

java.lang.Object
com.softsynth.jmsl.util.JMSLMath

public class JMSLMath
extends java.lang.Object
Some static methods for logarithms and other misc useful math
Author:
Nick Didkovsky, email: nick@didkovsky.com, (c) 2004 Nick Didkovsky, all rights reserved.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static double ln2
    precalculated for logBase2 operation
  • Constructor Summary

    Constructors
    Constructor Description
    JMSLMath()  
  • Method Summary

    Modifier and Type Method Description
    static int highestPowerOfTwoLessThan​(int n)  
    static double log​(double base, double n)  
    static double logBase2​(double n)  
    static void main​(java.lang.String[] args)  
    static double roundToHalf​(double d)  

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ln2

      public static final double ln2
      precalculated for logBase2 operation
  • Constructor Details

    • JMSLMath

      public JMSLMath()
  • Method Details

    • logBase2

      public static double logBase2​(double n)
      Returns:
      log base 2 of argument
    • log

      public static double log​(double base, double n)
      Returns:
      log base n of m (general algorithm: logm(n) = ln(n)/ln(base)
    • highestPowerOfTwoLessThan

      public static int highestPowerOfTwoLessThan​(int n)
    • roundToHalf

      public static double roundToHalf​(double d)
    • main

      public static void main​(java.lang.String[] args)