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

NaN and Infinity should not be equal to themselves #3126

Open
nex3 opened this issue Sep 4, 2020 · 2 comments
Open

NaN and Infinity should not be equal to themselves #3126

nex3 opened this issue Sep 4, 2020 · 2 comments
Labels
Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem Dart Backport Done

Comments

@nex3
Copy link
Contributor

nex3 commented Sep 4, 2020

For consistency with other Sass implementations, NaN (as returned by 0/0) and the positive and negative infinities (1/0 and -1/0) should not be equal to themselves.

@nex3 nex3 added the Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem label Sep 4, 2020
@nschonni
Copy link
Collaborator

nschonni commented Sep 5, 2020

Will probably be something in here

libsass/src/operators.cpp

Lines 154 to 157 in 97be6a3

if (op == Sass_OP::DIV && rval == 0) {
sass::string result(lval ? "Infinity" : "NaN");
return SASS_MEMORY_NEW(String_Quoted, pstate, result);
}

@mgreter
Copy link
Contributor

mgreter commented Mar 4, 2021

Is there a spec test for this?
Looks like latests 4.0 branch reports it correctly:

test {
    tst1: 1/0 == -1/0;
    tst3: -1/0 == 0/0;
    tst2: 1/0 == 0/0;
}

Expected result is false for all cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compatibility - P3 Minorly important for compatibility with the Sass spec and ecosystem Dart Backport Done
Projects
None yet
Development

No branches or pull requests

3 participants