Skip to content

An inconsistent result when encounter a negative 0 with toString function in dart2js #28622

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

Closed
jumperchen opened this issue Feb 3, 2017 · 2 comments
Labels
closed-duplicate Closed in favor of an existing report web-dart2js

Comments

@jumperchen
Copy link

For example,
if foo is a 0 number.
(-foo).toString() in Browser and DartVM env. will be "0"
But dart2js will be this code.
J.toString$0$(J.$negate$n(foo))
the result will be "-0.0"

Here is the source code from dart2js:

toString$0: function(receiver) {
    if (receiver === 0 && 1 / receiver < 0)
      return "-0.0";
    else
      return "" + receiver;
  },
@zoechi
Copy link
Contributor

zoechi commented Feb 3, 2017

Sounds like #4984 (comment)

@lrhn lrhn added web-dart2js closed-duplicate Closed in favor of an existing report labels Feb 3, 2017
@lrhn
Copy link
Member

lrhn commented Feb 3, 2017

It is indeed #4984 rearing its ugly head again.

@lrhn lrhn closed this as completed Feb 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants