Skip to content

Commit 60ab071

Browse files
mgreterxzyfer
authored andcommitted
Fix handling of negative results in modulo operator
Fixes #1029
1 parent 8281b95 commit 60ab071

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

eval.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ namespace Sass {
2525
inline double sub(double x, double y) { return x - y; }
2626
inline double mul(double x, double y) { return x * y; }
2727
inline double div(double x, double y) { return x / y; } // x/0 checked by caller
28+
inline double mod(double x, double y) { return abs(fmod(x, y)); } // x/0 checked by caller
29+
2830
typedef double (*bop)(double, double);
2931
bop ops[Binary_Expression::NUM_OPS] = {
3032
0, 0, // and, or
3133
0, 0, 0, 0, 0, 0, // eq, neq, gt, gte, lt, lte
32-
add, sub, mul, div, fmod
34+
add, sub, mul, div, mod
3335
};
3436

3537
Eval::Eval(Context& ctx, Contextualize* contextualize, Listize* listize, Env* env, Backtrace* bt)

0 commit comments

Comments
 (0)