Normalize floating point negative zero to positive zero in `flodivmod'.

parent 28405d26
...@@ -320,6 +320,8 @@ flodivmod(mrb_state *mrb, double x, double y, mrb_float *divp, mrb_float *modp) ...@@ -320,6 +320,8 @@ flodivmod(mrb_state *mrb, double x, double y, mrb_float *divp, mrb_float *modp)
div = (x - mod) / y; div = (x - mod) / y;
if (modp && divp) div = round(div); if (modp && divp) div = round(div);
} }
if (div == 0) div = 0.0;
if (mod == 0) mod = 0.0;
if (y*mod < 0) { if (y*mod < 0) {
mod += y; mod += y;
div -= 1.0; div -= 1.0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment