Skip to content

Commit

Permalink
Merge pull request sass#2597 from mgreter/bugfix/issue-2593
Browse files Browse the repository at this point in the history
Adjust output/error for modulo zero operation
  • Loading branch information
mgreter authored Mar 17, 2018
2 parents 035bfef + 91dd504 commit 1f56197
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ namespace Sass {
double lval = lhs.value();
double rval = rhs.value();

if (op == Sass_OP::MOD && rval == 0) {
return SASS_MEMORY_NEW(String_Quoted, pstate, "NaN");
}

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

if (op == Sass_OP::MOD && rval == 0) {
throw Exception::ZeroDivisionError(lhs, rhs);
}

size_t l_n_units = lhs.numerators.size();
size_t l_d_units = lhs.numerators.size();
size_t r_n_units = rhs.denominators.size();
Expand Down

0 comments on commit 1f56197

Please sign in to comment.