return normNum(e.fold(isFn));
}
private static Expression normNum(Expression e) {
if (!(e instanceof RealLiteral)) { return e; }
RealLiteral rl = (RealLiteral) e;
Number n = rl.getValue();
double dv = n.doubleValue();
long lv = n.longValue();
// Convert 1.0 to 1, but do not convert -0.0 to 0.
if (dv == lv && (dv != 0d || (1 / dv) > 0)) {
return new IntegerLiteral(rl.getFilePosition(), lv);
}
return rl;
}