diff --git a/quickjs.c b/quickjs.c index cf03515d4..3feab9fb1 100644 --- a/quickjs.c +++ b/quickjs.c @@ -42189,14 +42189,29 @@ static JSValue js_math_random(JSContext *ctx, JSValueConst this_val, return __JS_NewFloat64(ctx, u.d - 1.0); } +static double qjs_ceil(double x) +{ + return ceil(x); +} + +static double qjs_floor(double x) +{ + return floor(x); +} + +static double qjs_sqrt(double x) +{ + return sqrt(x); +} + static const JSCFunctionListEntry js_math_funcs[] = { JS_CFUNC_MAGIC_DEF("min", 2, js_math_min_max, 0 ), JS_CFUNC_MAGIC_DEF("max", 2, js_math_min_max, 1 ), JS_CFUNC_SPECIAL_DEF("abs", 1, f_f, fabs ), - JS_CFUNC_SPECIAL_DEF("floor", 1, f_f, floor ), - JS_CFUNC_SPECIAL_DEF("ceil", 1, f_f, ceil ), + JS_CFUNC_SPECIAL_DEF("floor", 1, f_f, qjs_floor ), + JS_CFUNC_SPECIAL_DEF("ceil", 1, f_f, qjs_ceil ), JS_CFUNC_SPECIAL_DEF("round", 1, f_f, js_math_round ), - JS_CFUNC_SPECIAL_DEF("sqrt", 1, f_f, sqrt ), + JS_CFUNC_SPECIAL_DEF("sqrt", 1, f_f, qjs_sqrt ), JS_CFUNC_SPECIAL_DEF("acos", 1, f_f, acos ), JS_CFUNC_SPECIAL_DEF("asin", 1, f_f, asin ),