functions returning integer result keep integer precision

This commit is contained in:
gnembon committed 2021-03-12 06:11:07 -04:00
1 parent e51451db83
commit ece43b6213
1 file changed
+3 -3
@@ -60,9 +60,9 @@ public class Arithmetic {
expression.addMathematicalUnaryFunction("log1p", x -> Math.log1p(x)/Math.log(2)); expression.addMathematicalUnaryFunction("log1p", x -> Math.log1p(x)/Math.log(2));
expression.addMathematicalUnaryFunction("sqrt", Math::sqrt); expression.addMathematicalUnaryFunction("sqrt", Math::sqrt);
expression.addMathematicalUnaryFunction("abs", Math::abs); expression.addMathematicalUnaryFunction("abs", Math::abs);
expression.addMathematicalUnaryFunction("round", (d) -> (double)Math.round(d)); expression.addMathematicalUnaryIntFunction("round", Math::round);
expression.addMathematicalUnaryFunction("floor", Math::floor); expression.addMathematicalUnaryIntFunction("floor", n -> (long)Math.floor(n));
expression.addMathematicalUnaryFunction("ceil", Math::ceil); expression.addMathematicalUnaryIntFunction("ceil", n -> (long)Math.ceil(n));
expression.addLazyFunction("mandelbrot", 3, (c, t, lv) -> { expression.addLazyFunction("mandelbrot", 3, (c, t, lv) -> {
double a0 = NumericValue.asNumber(lv.get(0).evalValue(c)).getDouble(); double a0 = NumericValue.asNumber(lv.get(0).evalValue(c)).getDouble();