-
Notifications
You must be signed in to change notification settings - Fork 29
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
Float support #115
Float support #115
Conversation
✔️ Deploy Preview for dada-lang ready! 🔨 Explore the source changes: 8576694 🔍 Inspect the deploy log: https://app.netlify.com/sites/dada-lang/deploys/620490a3ba40780008161d07 😎 Browse the preview: https://deploy-preview-115--dada-lang.netlify.app |
This is missing a negative test case for "1." I'll add it later. |
I added a test that parsing floats without decimals is an error. The span pointing to the dot is not quite right, but I don't know how to fix it offhand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good!
Can we add a test for 1_000.222_444
or something like that?
# nan != nan | ||
var nan1 = 0.0 / 0.0 | ||
var nan2 = 0.0 / 0.0 | ||
if nan1 == nan2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, I am so tempted to change this behavior and adopt IEEE total order for floats. =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll open an issue.
@@ -0,0 +1,5 @@ | |||
fn main() { | |||
a = 1. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we permit this? People sometimes do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no opinion.
I've added this test. Note the syntax supports trailing underscores like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
bors r+ |
Build succeeded: |
I found myself wanting floats for dogfooding the repl.
This is using the almost unused and unmaintained eq_float crate to store Eq-implementing floats in the IR. I'm happy to do something else.
Fixes #64