-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Big number support unclear with arithmetic operations #6281
Comments
It would be good to understand the expected behavior of a particular test case for example. I ran few of the cases in https://raw.githubusercontent.com/microsoft/rego-cpp/main/tests/bigint.yaml and the actual results seems to not lose precision. Maybe I missed something so would be helpful to get more clarification so we can fix the behavior if possible. |
@tsandall some more context here would be helpful. Thanks! |
For some context, if I create this Rego file:
And evaluate it, I get the following result: {
"result": [
{
"expressions": [
{
"value": [
false,
false,
false,
false,
false
],
"text": "data.bigint.output",
"location": {
"row": 1,
"col": 1
}
}
]
}
]
} |
(I would expect the division to fail, as there is no concept of integer division in the language, but the rest should pass) |
The arithmetic operators use the go math/big library under the hood however we seem to be running into loss-of-precision problems with several test cases. These cases from the rego-cpp implementation fail against topdown: https://raw.githubusercontent.com/microsoft/rego-cpp/main/tests/bigint.yaml
We should either fix topdown to support arithmetic on big numbers or clearly document what's supported (vs what is not.)
The text was updated successfully, but these errors were encountered: