-
Notifications
You must be signed in to change notification settings - Fork 301
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
floating point bounds not as expected #1310
Comments
Are you trying to say it must be outside of What you have wrote is that it must be both >=2.1 and <=1.0 at the same time. You may be looking for |
This is only an example for the issue. If I evaluate ">=2.1 & <=1.1" or ">=2 & <=1" at the same time, cue correctly reports an error. For ">=2.1 & <=1.0" not. Originally my values were derrived from multiple schemes, but this example reproduces the behaviour in the most simple way. |
Ah, this same unreported error happens for I have a hunch this has to do with mixed type comparison (number vs int) and that |
Also, just as an FYI, https://pkg.go.dev/cuelang.org/[email protected]/internal/core/adt#Num (the comment there looks to confirm |
Interesting. Should be easy to fix. |
I think the bug is around: cue/internal/core/adt/simplify.go Line 130 in 3b0a537
Decimal d.Int64() returns an error if d is not an integer, and SimplifyBounds returns nil. So if the difference between the high and low bound is not integral, then simplification is not done for floats.
|
@antong: the bug was indeed in that switch statement. |
Equal case was not checked for floats. Fixes #1310 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Icd5d2aba5080fae3b42a4abd5544ca4c579f29c6 Signed-off-by: Marcel van Lohuizen <[email protected]>
Equal case was not checked for floats. Fixes #1310 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Icd5d2aba5080fae3b42a4abd5544ca4c579f29c6 Signed-off-by: Marcel van Lohuizen <[email protected]>
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
yes
What did you do?
evaluated
What did you expect to see?
foo.value: incompatible bounds >=2.1 and <=1.0
What did you see instead?
The text was updated successfully, but these errors were encountered: