| Type | Name and description |
|---|---|
java.lang.Object |
DEFAULT_DECIMAL_DIGITS |
java.lang.Object |
ROUNDING_MODES |
java.lang.Object |
ROUNDING_RULES |
java.lang.Object |
ROUNDING_TYPES |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected BigDecimal |
getComparePart(BigDecimal numberToRound, BigDecimal roundingTarget)Get compare part of a number |
|
protected BigDecimal |
getRoundedDownDecimal(BigDecimal numberToRound, BigDecimal roundingTarget)Get the nearest number that less than the number to be rounded and have the suffix in decimal part |
|
protected BigDecimal |
getRoundedDownWhole(BigDecimal numberToRound, BigDecimal roundingTarget)Get the nearest number that less than the number to be rounded and have the suffix in whole number part |
|
protected BigDecimal |
getRoundedNumber(BigDecimal down, BigDecimal up, BigDecimal numberToRound, java.lang.String roundingDirection)Round a number with specified end points |
|
protected BigDecimal |
getRoundedUpDecimal(BigDecimal numberToRound, BigDecimal roundingTarget)Get the nearest number that greater than the number to be rounded and have the suffix in decimal part |
|
protected BigDecimal |
getRoundedUpWhole(BigDecimal numberToRound, BigDecimal roundingTarget)Get the nearest number that greater than the number to be rounded and have the suffix in whole number part |
|
protected int |
getRoundingModeEnum(java.lang.String direction)Get rounding mode in standard enum |
null |
static void |
main(java.lang.String[] args)Implicit main method for Groovy Scripts |
|
BigDecimal |
round(BigDecimal number, int decimalPlaces)A general function that rounds a number to N decimals |
|
BigDecimal |
round(BigDecimal numberToRound, java.lang.String rule, java.lang.String direction)Transforms a number to have a specific suffix. |
|
BigDecimal |
roundPercent(BigDecimal price)Round a percentage to 2 decimals or upon based on a rounding lookup table name if provided. |
|
BigDecimal |
roundPrice(BigDecimal price, int decimalPlaces)Rounds a price to N decimals |
|
BigDecimal |
roundUp(BigDecimal number, int decimalPlaces)A general function that rounds up a number to N decimals |
|
protected BigDecimal |
trunc(BigDecimal number)Remove decimal part of a BigDecimal |
| Methods inherited from class | Name |
|---|---|
class groovy.lang.Script |
groovy.lang.Script#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.Script#evaluate(java.lang.String), groovy.lang.Script#evaluate(java.io.File), groovy.lang.Script#getBinding(), groovy.lang.Script#setBinding(groovy.lang.Binding), groovy.lang.Script#println(), groovy.lang.Script#println(java.lang.Object), groovy.lang.Script#run(java.io.File, [Ljava.lang.String;), groovy.lang.Script#run(), groovy.lang.Script#setProperty(java.lang.String, java.lang.Object), groovy.lang.Script#getProperty(java.lang.String), groovy.lang.Script#print(java.lang.Object), groovy.lang.Script#printf(java.lang.String, java.lang.Object), groovy.lang.Script#printf(java.lang.String, [Ljava.lang.Object;), groovy.lang.Script#getMetaClass(), groovy.lang.Script#setMetaClass(groovy.lang.MetaClass), groovy.lang.Script#wait(long, int), groovy.lang.Script#wait(long), groovy.lang.Script#wait(), groovy.lang.Script#equals(java.lang.Object), groovy.lang.Script#toString(), groovy.lang.Script#hashCode(), groovy.lang.Script#getClass(), groovy.lang.Script#notify(), groovy.lang.Script#notifyAll() |
class groovy.lang.GroovyObjectSupport |
groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll() |
Get compare part of a number
numberToRound - BigDecimal the number contains part to be takenroundingTarget - BigDecimal the number to be comparedGet the nearest number that less than the number to be rounded and have the suffix in decimal part
numberToRound - BigDecimal the number to be roundedroundingTarget - BigDecimal the suffix number to haveGet the nearest number that less than the number to be rounded and have the suffix in whole number part
numberToRound - BigDecimal the number to be roundedroundingTarget - BigDecimal the suffix number to haveRound a number with specified end points
down - BigDecimal the lower endup - BigDecimal the higher endnumberToRound - BigDecimal the number to be roundedroundingDirection - String rounding direction / modeGet the nearest number that greater than the number to be rounded and have the suffix in decimal part
numberToRound - BigDecimal the number to be roundedroundingTarget - BigDecimal the suffix number to haveGet the nearest number that greater than the number to be rounded and have the suffix in whole number part
numberToRound - BigDecimal the number to be roundedroundingTarget - BigDecimal the suffix number to haveGet rounding mode in standard enum
direction - String rounding direction / modeImplicit main method for Groovy Scripts
A general function that rounds a number to N decimals
Transforms a number to have a specific suffix.
numberToRound - BigDecimal the number to be rounded. Only positive numbers are supported.rule - String name of the rule to be applied
supported rule: To49Cents, To50Cents, To95Cents, To99Cents, ToWhole, To5Whole, To49Whole, To99Whole, RawPrice, NoRoundingdirection - String the direction / mode of rounding
supported direction: UP, DOWN, HALF_UP, HALF_DOWNRound a percentage to 2 decimals or upon based on a rounding lookup table name if provided.
Rounds a price to N decimals
A general function that rounds up a number to N decimals
Remove decimal part of a BigDecimal
number - BigDecimal the number to be truncated