Bugfix for Logic Ops (#2535)

Performing some operations on larger numbers gave erroneous results when converting from doubles to ints. Now uses longs instead, which should help.
This commit is contained in:
LordChrom
2020-09-10 18:14:03 -05:00
committed by GitHub
parent e6eb847d81
commit 007a0da40a

View File

@ -15,18 +15,18 @@ public enum LogicOp{
greaterThan(">", (a, b) -> a > b ? 1 : 0),
greaterThanEq(">=", (a, b) -> a >= b ? 1 : 0),
pow("^", Math::pow),
shl(">>", (a, b) -> (int)a >> (int)b),
shr("<<", (a, b) -> (int)a << (int)b),
or("or", (a, b) -> (int)a | (int)b),
and("and", (a, b) -> (int)a & (int)b),
xor("xor", (a, b) -> (int)a ^ (int)b),
shl(">>", (a, b) -> (long)a >> (long)b),
shr("<<", (a, b) -> (long)a << (long)b),
or("or", (a, b) -> (long)a | (long)b),
and("and", (a, b) -> (long)a & (long)b),
xor("xor", (a, b) -> (long)a ^ (long)b),
max("max", Math::max),
min("min", Math::min),
atan2("atan2", (x, y) -> Mathf.atan2((float)x, (float)y) * Mathf.radDeg),
dst("dst", (x, y) -> Mathf.dst((float)x, (float)y)),
noise("noise", LExecutor.noise::rawNoise2D),
not("not", a -> ~(int)(a)),
not("not", a -> ~(long)(a)),
abs("abs", a -> Math.abs(a)),
log("log", Math::log),
log10("log10", Math::log10),