Skip to content
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

wasm: fix some bugs wrt. comparisons, ordering #2999

Merged
merged 3 commits into from
Dec 14, 2020

Conversation

srenatus
Copy link
Contributor

Since anything can happen, we now list the possibilities (3! = 6),
and check that any of them was the result.

Fixes open-policy-agent#2924.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Same as in topdown, we should have this be true in wasm:

    round(1.5) == 2
    round(2.5) == 3

The default rounding mode for libmpdec's maxcontext was MPD_ROUND_HALF_EVEN,
would would round 2.5 to 2.

See https://www.bytereef.org/mpdecimal/doc/libmpdec/context.html#rounding

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
I'm not exactly sure why we had been rounding here before. Topdown truncates
when formatting a decimal number as int:

    format_int(15.9, 16) == "f"
    format_int(-15.9, 16) == "-f"

Fixes open-policy-agent#2923.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@tsandall tsandall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tsandall tsandall merged commit a2cab3f into open-policy-agent:master Dec 14, 2020
@srenatus srenatus deleted the sr/wasm/misc-errors branch December 14, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wasm: String concat set ordering wasm: format_int "strings: invalid rounding: internal error"
3 participants