[package]
[Java implementation]
[Execution output]
BigDecimals
import java.math.BigDecimal;
import church.lang.Array;bigDecimal(double: d) = BigDecimal.valueOf(d);stream << (BigDecimal: a) = stream << a.toString();(BigDecimal: a) == (BigDecimal: b) = a.equals(b);additive_identity = BigDecimal.ZERO;
(BigDecimal: a) + (BigDecimal: b) = a.add(b);
-(BigDecimal: a) = a.negate();
multiplicative_identity = BigDecimal.ONE;
(BigDecimal: a) * (BigDecimal: b) = a.multiply(b);
(BigDecimal: a) ^ (int: n) = a.pow(n);divide(BigDecimal: a, BigDecimal: b, f) = {qNr = a.divideAndRemainder(b); f(qNr[0], qNr[1])};
quotient(BigDecimal: a, BigDecimal: b) = a.divide(b);
(BigDecimal: a) % (BigDecimal: b) = a.remainder(b);compare(BigDecimal: a, BigDecimal: b) = {
c = a.compareTo(b);
if c < 0 then Ordering.LT else
if c > 0 then Ordering.GT else
Ordering.EQ;
};