mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-27 10:45:08 -06:00
0c2d3ab992
The the arithmetic and aggregate builtin functions make use of builtins.FloatToNumber to convert big floats back into AST number values for returning to the evaluator. Previously the builtins.FloatToNumber function used big.Float#String to perform the conversion--however, this function sets the default precision to 10 which causes loss of precision. The fix simply updates the helper function to use big.Float#Text instead and set precision to -1 which uses as many places as necessary. In future, we may want to give users control over precision to aid in situations where clients cannot deal with large JSON numbers. Fixes #2469 Signed-off-by: Torin Sandall <torinsandall@gmail.com>