Skip to content

Commit

Permalink
LDEV-5189 - improve BigDecimal handling
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 9, 2024
1 parent 75c6dd2 commit f6b3fa1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
**/
package lucee.runtime.functions.string;

import java.math.BigDecimal;
import java.math.BigInteger;

import lucee.commons.lang.StringUtil;
import lucee.runtime.PageContext;
import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.exp.ExpressionException;
import lucee.runtime.exp.PageException;
import lucee.runtime.op.Caster;
Expand Down Expand Up @@ -87,7 +91,10 @@ else if (strRadix.startsWith("hex")) {
if (radix == DEC) {
return Caster.toNumber(pc, strNumber);
}

if (ThreadLocalPageContext.preciseMath(pc)) {
return new BigDecimal(new BigInteger(strNumber, radix));
}
return Integer.parseInt(strNumber, radix);
}

}

0 comments on commit f6b3fa1

Please sign in to comment.