Bug 458431 - expression-ordering fix for traced Math.max(0,-0), r=mrbkap

This commit is contained in:
Graydon Hoare
2008-10-03 14:07:33 -07:00
parent 1cfc81fbdf
commit ae85565984
2 changed files with 13 additions and 1 deletions

View File

@@ -214,7 +214,13 @@ js_Math_max(jsdouble d, jsdouble p)
if (p == 0 && p == d && fd_copysign(1.0, d) == -1)
return p;
return (d > p) ? d : p;
/*
* Note: it is essential that you write the ternary expression here such
* that the false branch produces d not p, as the case of p=-0, d=0, for
* which we wind up in this expression but evaluate either > order as
* false, whether we do p>d *or* d>p.
*/
return (p > d) ? p : d;
}
JSBool FASTCALL