Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JSBool
- js_math_max(JSContext *cx, uintN argc, Value *vp)
- {
- jsdouble x, z = js_NegativeInfinity;
- Value *argv;
- uintN i;
- if (argc == 0) {
- vp->setDouble(js_NegativeInfinity);
- return JS_TRUE;
- }
- argv = vp + 2;
- for (i = 0; i < argc; i++) {
- if (!ValueToNumber(cx, argv[i], &x))
- return JS_FALSE;
- if (JSDOUBLE_IS_NaN(x)) {
- vp->setDouble(js_NaN);
- return JS_TRUE;
- }
- if (x == 0 && x == z) {
- if (js_copysign(1.0, z) == -1)
- z = x;
- } else {
- z = (x > z) ? x : z;
- }
- }
- vp->setNumber(z);
- return JS_TRUE;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement