Documentation of 'org.matheclipse.core.expression.NumberUtil' Java class
NumberUtil
org.matheclipse.core.expression

Class NumberUtil



  • public class NumberUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.math.BigInteger MINUS_ONE 
    • Constructor Summary

      Constructors 
      Constructor and Description
      NumberUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.math.BigInteger ceiling(BigFraction f)
      Ceiling, round towards positive infinity.
      static java.math.BigInteger floor(BigFraction f)
      Floor, round towards negative infinity.
      static BigFraction fractionalPart(BigFraction f)
      Fractional part.
      static java.math.BigInteger integerPart(BigFraction f)
      Integer part.
      static BigFraction inverse(BigFraction fraction) 
      static boolean isEven(java.math.BigInteger a) 
      static boolean isLargerThan(BigFraction a, BigFraction b)
      Compares the absolute value of two rational numbers.
      static boolean isLargerThan(java.math.BigInteger a, java.math.BigInteger b) 
      static boolean isLessThan(java.math.BigInteger a, java.math.BigInteger b) 
      static boolean isMinusOne(java.math.BigInteger a) 
      static boolean isMinusOne(IExpr i) 
      static boolean isNegative(BigFraction a) 
      static boolean isNegative(java.math.BigInteger a) 
      static boolean isOdd(java.math.BigInteger a) 
      static boolean isOne(java.math.BigInteger a) 
      static boolean isOne(IExpr i) 
      static boolean isPerfectSquare(BigFraction bf)
      Test if the fraction value is a perfect square (i.e.
      static boolean isPerfectSquare(java.math.BigInteger bi)
      Test if the value is a perfect square (i.e.
      static boolean isPerfectSquare(long n)
      Test if a long value is a perfect square (i.e.
      static boolean isPositive(BigFraction a) 
      static boolean isPositive(java.math.BigInteger a) 
      static boolean isZero(BigFraction fraction) 
      static boolean isZero(java.math.BigInteger a) 
      static boolean isZero(IExpr e) 
      static java.math.BigInteger round(BigFraction f, int roundMode)
      Round.
      static int toInt(java.math.BigInteger a)
      Converts this number to int; unlike #intValue this method raises ArithmeticException if this integer cannot be represented by an int type.
      static int toInt(double d)
      Converts this number to int; unlike #intValue this method raises ArithmeticException if this integer cannot be represented by an int type.
      static long toLong(java.math.BigInteger a) 
      static long toLong(double d)
      Converts this number to long; unlike #longValue this method raises ArithmeticException if this integer cannot be represented by an long type.
      static java.math.BigInteger trunc(BigFraction f)
      Truncate, round towards zero.
      • Methods inherited from class java.lang.Object

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

      • MINUS_ONE

        public static final java.math.BigInteger MINUS_ONE
    • Constructor Detail

      • NumberUtil

        public NumberUtil()
    • Method Detail

      • isZero

        public static boolean isZero(IExpr e)
      • isZero

        public static boolean isZero(BigFraction fraction)
      • isOne

        public static boolean isOne(IExpr i)
      • isMinusOne

        public static boolean isMinusOne(IExpr i)
      • isLargerThan

        public static boolean isLargerThan(java.math.BigInteger a,
                                           java.math.BigInteger b)
      • isLessThan

        public static boolean isLessThan(java.math.BigInteger a,
                                         java.math.BigInteger b)
      • isNegative

        public static boolean isNegative(java.math.BigInteger a)
      • isPositive

        public static boolean isPositive(java.math.BigInteger a)
      • isZero

        public static boolean isZero(java.math.BigInteger a)
      • isOne

        public static boolean isOne(java.math.BigInteger a)
      • isMinusOne

        public static boolean isMinusOne(java.math.BigInteger a)
      • isEven

        public static boolean isEven(java.math.BigInteger a)
      • isOdd

        public static boolean isOdd(java.math.BigInteger a)
      • toLong

        public static long toLong(java.math.BigInteger a)
                           throws java.lang.ArithmeticException
        Throws:
        java.lang.ArithmeticException
      • toInt

        public static int toInt(java.math.BigInteger a)
                         throws java.lang.ArithmeticException
        Converts this number to int; unlike #intValue this method raises ArithmeticException if this integer cannot be represented by an int type.
        Returns:
        the numeric value represented by this integer after conversion to type int.
        Throws:
        java.lang.ArithmeticException - if conversion to int is not possible.
      • toInt

        public static int toInt(double d)
                         throws java.lang.ArithmeticException
        Converts this number to int; unlike #intValue this method raises ArithmeticException if this integer cannot be represented by an int type.
        Returns:
        the numeric value represented by this number after conversion to type int.
        Throws:
        java.lang.ArithmeticException - if conversion to int is not possible.
      • toLong

        public static long toLong(double d)
                           throws java.lang.ArithmeticException
        Converts this number to long; unlike #longValue this method raises ArithmeticException if this integer cannot be represented by an long type.
        Returns:
        the numeric value represented by this number after conversion to type long.
        Throws:
        java.lang.ArithmeticException - if conversion to long is not possible.
      • isLargerThan

        public static boolean isLargerThan(BigFraction a,
                                           BigFraction b)
        Compares the absolute value of two rational numbers.
        Parameters:
        that - the rational number to be compared with.
        Returns:
        |this| > |that|
      • isNegative

        public static boolean isNegative(BigFraction a)
      • isPositive

        public static boolean isPositive(BigFraction a)
      • floor

        public static java.math.BigInteger floor(BigFraction f)
        Floor, round towards negative infinity.

        Possible loss of precision.

      • ceiling

        public static java.math.BigInteger ceiling(BigFraction f)
        Ceiling, round towards positive infinity.

        Possible loss of precision.

      • trunc

        public static java.math.BigInteger trunc(BigFraction f)
        Truncate, round towards zero.

        Possible loss of precision.

      • integerPart

        public static java.math.BigInteger integerPart(BigFraction f)
        Integer part.

        Possible loss of precision.

      • fractionalPart

        public static BigFraction fractionalPart(BigFraction f)
        Fractional part.

        Possible loss of precision.

      • round

        public static java.math.BigInteger round(BigFraction f,
                                                 int roundMode)
        Round.

        Round mode is one of { ROUND_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR, ROUND_HALF_UP, ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_CEILING, ROUND_HALF_FLOOR, ROUND_HALF_ODD, ROUND_UNNECESSARY, DEFAULT_ROUND_MODE (==ROUND_HALF_UP) .

        If rounding isn't necessary, i.e. this BigRational is an integer, [as an optimization] this BigRational is returned.

        Possible loss of precision.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.