freemarker.core

## Class ArithmeticEngine.BigDecimalEngine

- java.lang.Object
- - freemarker.core.ArithmeticEngine
  - - freemarker.core.ArithmeticEngine.BigDecimalEngine

Enclosing class:
  ArithmeticEngine

    public static class ArithmeticEngine.BigDecimalEngine
    extends 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

Constructors
Constructor and Description
`BigDecimalEngine()`

### Method Summary

All Methods Instance Methods Concrete Methods
`Number` `add(Number first, Number second)`
`int` `compareNumbers(Number first, Number second)`
`Number` `divide(Number first, Number second)`
`Number` `modulus(Number first, Number second)`
`Number` `multiply(Number first, Number second)`
`Number` `subtract(Number first, Number second)`
`Number` `toNumber(String s)` 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BigDecimalEngine

    public BigDecimalEngine()

### Method Detail

#### compareNumbers

    public int compareNumbers(Number first,
                              Number second)

Specified by:
  `compareNumbers` in class `ArithmeticEngine`

#### add

    public Number add(Number first,
                      Number second)

Specified by:
  `add` in class `ArithmeticEngine`

#### subtract

    public Number subtract(Number first,
                           Number second)

Specified by:
  `subtract` in class `ArithmeticEngine`

#### multiply

    public Number multiply(Number first,
                           Number second)

Specified by:
  `multiply` in class `ArithmeticEngine`

#### divide

    public Number divide(Number first,
                         Number second)

Specified by:
  `divide` in class `ArithmeticEngine`

#### modulus

    public Number modulus(Number first,
                          Number second)

Specified by:
  `modulus` in class `ArithmeticEngine`

#### toNumber

    public Number toNumber(String s)

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 class `ArithmeticEngine`