Package freemarker.core
Class ArithmeticEngine.BigDecimalEngine
java.lang.Object
freemarker.core.ArithmeticEngine
freemarker.core.ArithmeticEngine.BigDecimalEngine
- Enclosing class:
- ArithmeticEngine
This is the default arithmetic engine in FreeMarker. It converts every
number it receives into
BigDecimal
, then operates on these
converted BigDecimal
s.-
Nested Class Summary
Nested classes/interfaces inherited from class freemarker.core.ArithmeticEngine
ArithmeticEngine.BigDecimalEngine, ArithmeticEngine.ConservativeEngine
-
Field Summary
Fields inherited from class freemarker.core.ArithmeticEngine
BIGDECIMAL_ENGINE, CONSERVATIVE_ENGINE, maxScale, minScale, roundingPolicy
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
compareNumbers(Number first, Number second)
Should be able to parse all FTL numerical literals, Java Double toString results, and XML Schema numbers.Methods inherited from class freemarker.core.ArithmeticEngine
setMaxScale, setMinScale, setRoundingPolicy
-
Constructor Details
-
BigDecimalEngine
public BigDecimalEngine()
-
-
Method Details
-
compareNumbers
- Specified by:
compareNumbers
in classArithmeticEngine
-
add
- Specified by:
add
in classArithmeticEngine
-
subtract
- Specified by:
subtract
in classArithmeticEngine
-
multiply
- Specified by:
multiply
in classArithmeticEngine
-
divide
- Specified by:
divide
in classArithmeticEngine
-
modulus
- Specified by:
modulus
in classArithmeticEngine
-
toNumber
Description copied from class:ArithmeticEngine
Should be able to parse all FTL numerical literals, Java Double toString results, and XML Schema numbers. This means these should be parsed successfully, except if the arithmetical engine couldn't support the resulting value anyway (such as NaN, infinite, even non-integers):-123.45
,1.5e3
,1.5E3
,0005
,+0
,-0
,NaN
,INF
,-INF
,Infinity
,-Infinity
.- Specified by:
toNumber
in classArithmeticEngine
-