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

$(-0.0) prints as -0.0; should that print as 0.0? #136

Closed
timotheecour opened this issue Apr 27, 2020 · 2 comments
Closed

$(-0.0) prints as -0.0; should that print as 0.0? #136

timotheecour opened this issue Apr 27, 2020 · 2 comments

Comments

@timotheecour
Copy link
Owner

timotheecour commented Apr 27, 2020

$(-0.0) prints as -0.0; should that print as 0.0?

Example

proc main()=
  var a = -0.0
  echo a
  echo -0
  echo $(-0.0)
  var b = a
  echo b
  echo cast[uint](a)

static: main()
main()

Current Output

-0.0
0
-0.0
-0.0
9223372036854775808

Expected Output

  • unclear whether we should print -0.0 as 0.0

Additional information

@ringabout
Copy link
Collaborator

It differs in JS backend

proc main()=
  var a = -0.0
  echo a
  echo -0
  echo $(-0.0)
  var b = a
  echo b

static: main()
main()

output:

-0.0
0
-0.0
-0.0

0.0
0
-0.0
0.0

@timotheecour
Copy link
Owner Author

fixed by nim-lang#16505 ; thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants