Skip to content

equal doubles are not identical, NaNs are identical #7024

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
DartBot opened this issue Nov 29, 2012 · 7 comments
Closed

equal doubles are not identical, NaNs are identical #7024

DartBot opened this issue Nov 29, 2012 · 7 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Nov 29, 2012

This issue was originally filed by [email protected]


Spec v0.13 12.1 Constants reads:

identical() is the predefined dart function that returns true iff its two
arguments are either:
   • The same object.
   • Of type int and have the same numeric value.
   • Of type double, are not NaNs and have the same numeric value.

However, for the type double, VM violates both conditions:

  • doubles with the same value, computated in different ways, are not identical.
  • NaNs, computated in the same way, are identical.

Affected tests:
Language/11_Expressions/01_Constants_A18_t05
Language/11_Expressions/01_Constants_A18_t06

@kmillikin
Copy link

cc @fsc8000.
cc @sgmitrovic.

@lrhn
Copy link
Member

lrhn commented Nov 29, 2012

As I read the spec, NaNs computed the same way may be the same object, and in that case should return true (from the first point - it's the same object).
This still breaks unboxing, so the first point should probably be conditioned by the objects not both being int and not both being double.

@anders-sandholm
Copy link
Contributor

cc @gbracha.
Added Area-VM, Triaged labels.

@gbracha
Copy link
Contributor

gbracha commented Nov 29, 2012

The spec needs some adjustment around NaNs. In fact, the VM team would like to change it, but we left it this way pending feedback from the dart2js team. The basic goal is to minimize surprises to the user. We were somewhat concerned about performance implications, but the VM testing indicates this is not a problem. WIth that in mind, I await feedback regarding dart2js.

@iposva-google
Copy link
Contributor

Removed Priority-Medium label.
Added Priority-Unassigned label.

@iposva-google
Copy link
Contributor

Set owner to @sgmitrovic.
Added Accepted label.

@ghost
Copy link

ghost commented Oct 21, 2013

AFAIK this was fixed and resolved a while ago. The tests listed do not exist any longer


Added AssumedStale label.

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant labels Oct 21, 2013
@DartBot DartBot assigned ghost Oct 21, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

6 participants