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

[test/interpreter] Rounding edge cases for float text literals #1025

Merged
merged 7 commits into from
May 29, 2019

Conversation

rossberg
Copy link
Member

@rossberg rossberg commented May 27, 2019

Fixes #809 and other double rounding edge cases.

Adds various tests for rounding on f32 and f64 literals.

Adds a gross hack to the interpreter to detect and correct double rounding without having to reimplement float parsing.

@rossberg rossberg requested a review from sunfishcode May 27, 2019 08:12
@rossberg rossberg changed the title [test/interpreter] Consider rounding edge cases for float text literals [test/interpreter] Rounding edge cases for float text literals May 27, 2019
@rossberg rossberg requested a review from binji May 27, 2019 08:14
Copy link
Member

@binji binji left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -135,3 +141,300 @@
(module quote "(func (f64.const -269653970229347356221791135597556535197105851288767494898376215204735891170042808140884337949150317257310688430271573696351481990334196274152701320055306275479074865864826923114368235135583993416113802762682700913456874855354834422248712838998185022412196739306217084753107265771378949821875606039276187287552) drop)")
"constant out of range"
)

;; NaNs
Copy link
Member

Choose a reason for hiding this comment

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

These seem similar to tests in float_literals.wast and int_literals.wast -- is it testing a different case?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, removed.

(func (export "f64") (param f64) (result f64) (local.get 0))
)

;; f32, small exponent
Copy link
Member

Choose a reason for hiding this comment

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

We should probably have some decimal test cases here too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@rossberg rossberg merged commit 4bf74f6 into master May 29, 2019
@rossberg rossberg deleted the f32-of_string branch May 29, 2019 20:33
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.

[interpreter] rounding for floating-point constants
2 participants