Class fMATH


  • public class fMATH
    extends Object
    math functions
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double PI
      PI constant
    • Constructor Summary

      Constructors 
      Constructor Description
      fMATH()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static double Abs​(double xValue)
      returns the absolute value of a numeric value
      static double Acos​(double xValue)
      returns the arc cosine of a numeric value
      static double Acosh​(double xValue)
      returns the area hyperboliccosine of a numeric value
      static double Acot​(double t)
      returns the arccotangent of a numeric value
      static double Acoth​(double xValue)
      returns the area hyperboliccotangent of a numeric value
      static double Acsc​(double xValue)
      returns the cosecantarc of the a number value (Y)
      static double Acsch​(double xValue)
      returns the area hyperboliccosecant of a numeric value
      static double Asec​(double x)
      returns the arcsecant of a numeric value (X)
      static double Asech​(double xValue)
      returns the area hyperbolicsecant of a numeric value
      static double Asin​(double xValue)
      returns the arcsine of a numeric value
      static double Asinh​(double xValue)
      returns the area hyperbolicsine of a numeric value
      static double Atan​(double xValue)
      returns the arctangent of a numeric value
      static double Atan2​(double Y, double X)
      returns the arctangent of the cartesian coordinate values
      static double Atanh​(double xValue)
      returns the area hyperbolictangent of a numeric value
      static double Cos​(double xValue)
      returns the cosine of an angle
      static double Cosh​(double xValue)
      returns the hyperboliccosine of a numeric value
      static double Cota​(double xValue)
      returns the cotangent of a numeric value
      static double Coth​(double xValue)
      returns the hyperboliccotangent of a numeric value
      static double Csch​(double xValue)
      returns the hyperboliccosecant of a numeric value
      static double Cscs​(double xValue)
      returns the cosecans of a numeric value
      static double Eval​(String xArithmeticExpression)
      returns the results of an arithmetic expression
      static double[] Eval2​(String[] xArithmeticExpressions)
      returns the results of an arithmetic expression array
      static double Exp​(double xValue)
      returns the base of natural logarithms raised to a power (e)
      static double Factorial​(long xNumber, int xMode)
      returns the factorial for the numeric value (xMode = 0 or 1)
      static double Fix​(double xValue)
      returns the integer part of a number
      static double GeoDistance​(double xLatitude1, double xLongitude1, double xLatitude2, double xLongitude2, int xMeasureUnit, int xAlgorithmType)
      returns the distance between two points identified by geographic coordinates
      static boolean IsPrime​(long xNumber)
      returns [true] if the value if it is a prime number, otherwise [false]
      static double Log​(double xValue)
      returns the natural logarithm of a numeric value
      static long MCD​(long x, long y)
      returns the greatest common divisor relative to two numeric values
      static long MCM​(long x, long y)
      returns the least common multiple relative to two numeric values
      static double Mod​(double xValue1, double xValue2)
      returns returns the remainder of a division
      static double Rnd()
      returns a random double value with a positive sign
      static double Rnd2​(double xValue)
      returns a random double value with a positive sign
      static double Round​(double xValue)
      returns a number rounded
      static double Round2​(double xValue, int xDigitsAfterDecimal)
      returns a number rounded to decimals specified
      static double Sec​(double xValue)
      returns the secant of a numeric value
      static double Sech​(double xValue)
      returns the hyperbolicsecant of a numeric value
      static int Sgn​(double xValue)
      checks the sign of a numeric value
      static int ShLint​(int xValue, int xShift)
      shifts the bits of value shift-bits to the left
      static long ShLlng​(long xValue, int xShift)
      shifts the bits of value shift-bits to the left
      static int ShRint​(int xValue, int xShift)
      shifts the bits of value shift-bits to the right and keeps the MSB
      static long ShRlng​(long xValue, int xShift)
      shifts the bits of value shift-bits to the right and keeps the MSB
      static int ShRZint​(int xValue, int xShift)
      shifts the bits of value shift-bits to the right and shifts also the MSB
      static long ShRZlng​(long xValue, int xShift)
      shifts the bits of value shift-bits to the right and shifts also the MSB
      static double Sin​(double xValue)
      returns the sine of an angle
      static double SinC​(double xValue)
      returns the sine cardinale of a numeric value
      static double Sinh​(double xValue)
      returns the hyperbolicsine of a numeric value
      static double Sqr​(double xValue)
      returns the square root of a numeric value
      static double Tan​(double xValue)
      returns the tangent of an angle
      static double Tanh​(double xValue)
      returns the hyperbolictangent of a numeric value
    • Field Detail

      • PI

        public static double PI
        PI constant
    • Constructor Detail

      • fMATH

        public fMATH()
    • Method Detail

      • Abs

        public static double Abs​(double xValue)
        returns the absolute value of a numeric value
        Parameters:
        xValue - the numeric expression
      • Acos

        public static double Acos​(double xValue)
        returns the arc cosine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Acosh

        public static double Acosh​(double xValue)
        returns the area hyperboliccosine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Acot

        public static double Acot​(double t)
        returns the arccotangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Acoth

        public static double Acoth​(double xValue)
        returns the area hyperboliccotangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Acsc

        public static double Acsc​(double xValue)
        returns the cosecantarc of the a number value (Y)
        Parameters:
        xValue - the numeric expression
      • Acsch

        public static double Acsch​(double xValue)
        returns the area hyperboliccosecant of a numeric value
        Parameters:
        xValue - the numeric expression
      • Asec

        public static double Asec​(double x)
        returns the arcsecant of a numeric value (X)
        Parameters:
        xValue - the numeric expression
      • Asech

        public static double Asech​(double xValue)
        returns the area hyperbolicsecant of a numeric value
        Parameters:
        xValue - the numeric expression
      • Asin

        public static double Asin​(double xValue)
        returns the arcsine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Asinh

        public static double Asinh​(double xValue)
        returns the area hyperbolicsine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Atan

        public static double Atan​(double xValue)
        returns the arctangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Atan2

        public static double Atan2​(double Y,
                                   double X)
        returns the arctangent of the cartesian coordinate values
        Parameters:
        X - the cartesian coordinate x
        Y - the cartesian coordinate y
      • Atanh

        public static double Atanh​(double xValue)
        returns the area hyperbolictangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Cos

        public static double Cos​(double xValue)
        returns the cosine of an angle
        Parameters:
        xValue - the value that expresses an angle in radian
      • Cosh

        public static double Cosh​(double xValue)
        returns the hyperboliccosine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Cota

        public static double Cota​(double xValue)
        returns the cotangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Coth

        public static double Coth​(double xValue)
        returns the hyperboliccotangent of a numeric value
        Parameters:
        xValue - the numeric expression
      • Csch

        public static double Csch​(double xValue)
        returns the hyperboliccosecant of a numeric value
        Parameters:
        xValue - the numeric expression
      • Cscs

        public static double Cscs​(double xValue)
        returns the cosecans of a numeric value
        Parameters:
        xValue - the numeric expression
      • Eval

        public static double Eval​(String xArithmeticExpression)
        returns the results of an arithmetic expression
        Parameters:
        xArithmeticExpression - the arithmetic expression xArithmeticExpressions (ae) example: ae = "(4*5(3-1)(67+23(25!)(5*6.5%2.2)))" or ae = "3+(4*5/3(2)(4)+45-1)" or ae = "(89*5/3(2(4(3(2))))(4)+57-1)"...
      • Eval2

        public static double[] Eval2​(String[] xArithmeticExpressions)
        returns the results of an arithmetic expression array
        Parameters:
        xArithmeticExpressions - () the arithmetic expression ArithmeticExpressions (ae[]) examples: ae(0) = "(4*5(3-1)(67+23(25!)(5*6.5%2.2)))" and ae(1) = "3+(4*5/3(2)(4)+45-1)" and ae(2) = "(89*5/3(2(4(3(2))))(4)+57-1)"...
      • Exp

        public static double Exp​(double xValue)
        returns the base of natural logarithms raised to a power (e)
        Parameters:
        xValue - the numeric expression
      • Factorial

        public static double Factorial​(long xNumber,
                                       int xMode)
        returns the factorial for the numeric value (xMode = 0 or 1)
      • Fix

        public static double Fix​(double xValue)
        returns the integer part of a number
        Parameters:
        xValue - the number in input
      • GeoDistance

        public static double GeoDistance​(double xLatitude1,
                                         double xLongitude1,
                                         double xLatitude2,
                                         double xLongitude2,
                                         int xMeasureUnit,
                                         int xAlgorithmType)
        returns the distance between two points identified by geographic coordinates
        Parameters:
        xLatitude1 - the latitude of point 1
        xLongitude1 - the longitude of point 1
        xLatitude2 - the latitude of point 2
        xLongitude2 - the longitude of point 2
        xMeasureUnit - the unit measure (0 = Km, 1 = Miles)
        xAlgorithmType - the type of algorithm used for the distance calculation (1 = haversine, 2 = spherical law of cosines, 3 = spherical earth projection)
      • IsPrime

        public static boolean IsPrime​(long xNumber)
        returns [true] if the value if it is a prime number, otherwise [false]
      • Log

        public static double Log​(double xValue)
        returns the natural logarithm of a numeric value
        Parameters:
        xValue - the numeric expression
      • MCD

        public static long MCD​(long x,
                               long y)
        returns the greatest common divisor relative to two numeric values
      • MCM

        public static long MCM​(long x,
                               long y)
        returns the least common multiple relative to two numeric values
      • Mod

        public static double Mod​(double xValue1,
                                 double xValue2)
        returns returns the remainder of a division
        Parameters:
        xValue1 - the number value to be divided
        xValue2 - the number value of the divisor
      • Rnd

        public static double Rnd()
        returns a random double value with a positive sign
      • Rnd2

        public static double Rnd2​(double xValue)
        returns a random double value with a positive sign
        Parameters:
        xValue - the numeric value that represents the "base"
      • Round

        public static double Round​(double xValue)
        returns a number rounded
        Parameters:
        xValue - the numeric expression being rounded
      • Round2

        public static double Round2​(double xValue,
                                    int xDigitsAfterDecimal)
        returns a number rounded to decimals specified
        Parameters:
        xValue - the numeric expression being rounded
        xDigitsAfterDecimal - the digits to the right of the decimal are included in the rounding
      • Sec

        public static double Sec​(double xValue)
        returns the secant of a numeric value
        Parameters:
        xValue - the numeric expression
      • Sech

        public static double Sech​(double xValue)
        returns the hyperbolicsecant of a numeric value
        Parameters:
        xValue - the numeric expression
      • Sgn

        public static int Sgn​(double xValue)
        checks the sign of a numeric value
        Parameters:
        xValue - the numeric expression returns -1 = less than zero (negative sign), 0 = equal to zero, 1 = greater than zero (positive sign)
      • ShLint

        public static int ShLint​(int xValue,
                                 int xShift)
        shifts the bits of value shift-bits to the left
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • ShLlng

        public static long ShLlng​(long xValue,
                                  int xShift)
        shifts the bits of value shift-bits to the left
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • ShRint

        public static int ShRint​(int xValue,
                                 int xShift)
        shifts the bits of value shift-bits to the right and keeps the MSB
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • ShRlng

        public static long ShRlng​(long xValue,
                                  int xShift)
        shifts the bits of value shift-bits to the right and keeps the MSB
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • ShRZint

        public static int ShRZint​(int xValue,
                                  int xShift)
        shifts the bits of value shift-bits to the right and shifts also the MSB
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • ShRZlng

        public static long ShRZlng​(long xValue,
                                   int xShift)
        shifts the bits of value shift-bits to the right and shifts also the MSB
        Parameters:
        xValue - the value to be shifted
        xShift - the amount of bits to shift the bits of value
      • Sin

        public static double Sin​(double xValue)
        returns the sine of an angle
        Parameters:
        xValue - the value that expresses an angle in radian
      • SinC

        public static double SinC​(double xValue)
        returns the sine cardinale of a numeric value
        Parameters:
        xValue - the numeric expression
      • Sinh

        public static double Sinh​(double xValue)
        returns the hyperbolicsine of a numeric value
        Parameters:
        xValue - the numeric expression
      • Sqr

        public static double Sqr​(double xValue)
        returns the square root of a numeric value
        Parameters:
        xValue - the numeric expression
      • Tan

        public static double Tan​(double xValue)
        returns the tangent of an angle
        Parameters:
        xValue - the numeric expression that expresses an angle in radians
      • Tanh

        public static double Tanh​(double xValue)
        returns the hyperbolictangent of a numeric value
        Parameters:
        xValue - the numeric expression