Class MathFunctions
java.lang.Object
net.sf.jasperreports.functions.standard.MathFunctions
This class should maintain all function methods that belongs to the Math category.
- Author:
- Massimo Rabbi (mrabbi@users.sourceforge.net)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic NumberReturns the absolute value of a number.static DoubleReturns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integerstatic LongReturns the factorial of a number.static DoubleReturns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer.static BooleanChecks if a number is even.static BooleanChecks if a number is odd.static NumberReturns the maximum of a list of numeric values.static NumberReturns the minimum of a list of numeric values.static NumberReturns the product of a list of numbers.static DoubleRAND()Returns a random number between 0.0 and 1.0.static IntegerRANDBETWEEN(Integer bottomRange, Integer topRange) Returns an Integer random number between bottom and top range (both inclusive).static BigDecimalROUND_CEILING(Number number, int scale) Returns a BigDecimal number rounded towards positive infinity.static BigDecimalROUND_DOWN(Number number, int scale) Returns a BigDecimal number rounded towards zero.static BigDecimalROUND_FLOOR(Number number, int scale) Returns a BigDecimal number rounded towards negative infinity.static BigDecimalROUND_HALF_DOWN(Number number, int scale) Returns a BigDecimal number rounded towards its nearest neighbor.static BigDecimalROUND_HALF_EVEN(Number number, int scale) Returns a BigDecimal number rounded towards its nearest neighbor.static BigDecimalROUND_HALF_UP(Number number, int scale) Returns a BigDecimal number rounded towards its nearest neighbor.static BigDecimalReturns a BigDecimal number rounded away from zero.static IntegerReturns the sign of a number.static NumberReturns the positive square root of a number.static NumberReturns the sum of a list of numbers.
-
Constructor Details
-
MathFunctions
public MathFunctions()
-
-
Method Details
-
ABS
Returns the absolute value of a number. -
FACT
Returns the factorial of a number. -
ISEVEN
Checks if a number is even. If a non-integer number is specified, any digits after the decimal point are ignored. -
ISODD
Checks if a number is odd. If a non-integer number is specified, any digits after the decimal point are ignored. -
PRODUCT
Returns the product of a list of numbers. -
RAND
Returns a random number between 0.0 and 1.0. -
RANDBETWEEN
Returns an Integer random number between bottom and top range (both inclusive). -
SIGN
Returns the sign of a number. -
SQRT
Returns the positive square root of a number. The number must be positive. -
SUM
Returns the sum of a list of numbers. -
MIN
Returns the minimum of a list of numeric values. -
MAX
Returns the maximum of a list of numeric values. -
FLOOR
Returns the largest (closest to positive infinity) double value that is less than or equal to the argument and is equal to a mathematical integer. -
CEIL
Returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer -
ROUND_UP
Returns a BigDecimal number rounded away from zero. It always increments the digit prior to a non-zero discarded fraction. -
ROUND_DOWN
Returns a BigDecimal number rounded towards zero. It never increments the digit prior to a discarded fraction -
ROUND_CEILING
Returns a BigDecimal number rounded towards positive infinity. For positive values behaves as theROUND_UP(java.lang.Number, int)function, for negative values behaves as theROUND_DOWN(java.lang.Number, int)function. -
ROUND_FLOOR
Returns a BigDecimal number rounded towards negative infinity. For positive values behaves as theROUND_DOWN(java.lang.Number, int)function, for negative values behaves as theROUND_UP(java.lang.Number, int)function. -
ROUND_HALF_UP
Returns a BigDecimal number rounded towards its nearest neighbor. If both neighbors are equidistant, the number is rounded up. Behaves as theROUND_UP(java.lang.Number, int)function if the discarded fraction is ≥ 0.5; otherwise, behaves as theROUND_DOWN(java.lang.Number, int)function. -
ROUND_HALF_EVEN
Returns a BigDecimal number rounded towards its nearest neighbor. If both neighbors are equidistant, the number is rounded towards the even neighbor. Behaves as theROUND_HALF_UP(java.lang.Number, int)function if the digit to the left of the discarded fraction is odd; otherwise, behaves as theROUND_HALF_DOWN(java.lang.Number, int)function. This rounding mode statistically minimizes cumulative error when it is repeatedly applied over a sequence of calculations. -
ROUND_HALF_DOWN
Returns a BigDecimal number rounded towards its nearest neighbor. If both neighbors are equidistant, the number is rounded down. Behaves as theROUND_UP(java.lang.Number, int)function if the discarded fraction is > 0.5; otherwise, behaves as theROUND_DOWN(java.lang.Number, int)function.
-