diff --git a/quickjs.c b/quickjs.c
index b315256..ccf0916 100644
@@ -10239,7 +10239,7 @@ static JSValue js_atof(JSContext *ctx, const char *str, const char **pp,
} else
#endif
{
- double d = 1.0 / 0.0;
+ double d = INFINITY;
if (is_neg)
d = -d;
val = JS_NewFloat64(ctx, d);
@@ -41736,7 +41736,7 @@ static JSValue js_math_min_max(JSContext *ctx, JSValueConst this_val,
uint32_t tag;
if (unlikely(argc == 0)) {
- return __JS_NewFloat64(ctx, is_max ? -1.0 / 0.0 : 1.0 / 0.0);
+ return __JS_NewFloat64(ctx, is_max ? -INFINITY : INFINITY);
}
tag = JS_VALUE_GET_TAG(argv[0]);
@@ -47843,7 +47843,7 @@ static const JSCFunctionListEntry js_global_funcs[] = {
JS_CFUNC_MAGIC_DEF("encodeURIComponent", 1, js_global_encodeURI, 1 ),
JS_CFUNC_DEF("escape", 1, js_global_escape ),
JS_CFUNC_DEF("unescape", 1, js_global_unescape ),
- JS_PROP_DOUBLE_DEF("Infinity", 1.0 / 0.0, 0 ),
+ JS_PROP_DOUBLE_DEF("Infinity", INFINITY, 0 ),
JS_PROP_DOUBLE_DEF("NaN", NAN, 0 ),
JS_PROP_UNDEFINED_DEF("undefined", 0 ),