exp: set float output for int modulus
authorJens Axboe <axboe@fb.com>
Mon, 29 Sep 2014 20:58:06 +0000 (14:58 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 29 Sep 2014 20:58:06 +0000 (14:58 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
exp/expression-parser.y

index fa19a51..f56ee6d 100644 (file)
@@ -138,8 +138,10 @@ expression:        expression '+' expression {
                                yyerror(0, 0, 0, 0, "modulo on floats");
                        if ($3.ival == 0)
                                yyerror(0, 0, 0, 0, "divide by zero");
-                       else
+                       else {
                                $$.ival = $1.ival % $3.ival;
+                               $$.dval = $$.ival;
+                       }
                        $$.has_error = $1.has_error || $3.has_error;
                }
        |       expression '^' expression {