Unified · Split
| @@ -259,6 +259,7 @@ static int sortcmp(const void *avoid, const void *bvoid) · 258 unmodified lines | ||
| 259 | 259 | const js_Value *a = &aslot->v, *b = &bslot->v; |
| 260 | 260 | js_State *J = aslot->J; |
| 261 | 261 | const char *sx, *sy; |
| 262 | + double v; | |
| 262 | 263 | int c; |
| 263 | 264 | |
| 264 | 265 | int unx = (a->type == JS_TUNDEFINED); |
| @@ -272,7 +273,8 @@ static int sortcmp(const void *avoid, const void *bvoid) · 7 unmodified lines | ||
| 272 | 273 | js_pushvalue(J, *a); |
| 273 | 274 | js_pushvalue(J, *b); |
| 274 | 275 | js_call(J, 2); |
| 275 | − c = js_tonumber(J, -1); | |
| 276 | + v = js_tonumber(J, -1); | |
| 277 | + c = (v == 0) ? 0 : (v < 0) ? -1 : 1; | |
| 276 | 278 | js_pop(J, 1); |
| 277 | 279 | } else { |
| 278 | 280 | js_pushvalue(J, *a); |