Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10814,7 +10814,7 @@ static __exception int __JS_ToFloat64Free(JSContext *ctx, double *pres,

val = JS_ToNumberFree(ctx, val);
if (JS_IsException(val)) {
*pres = JS_FLOAT64_NAN;
*pres = NAN;
return -1;
}
tag = JS_VALUE_GET_NORM_TAG(val);
Expand Down Expand Up @@ -12208,7 +12208,7 @@ static double js_math_pow(double a, double b)
{
if (unlikely(!isfinite(b)) && fabs(a) == 1) {
/* not compatible with IEEE 754 */
return JS_FLOAT64_NAN;
return NAN;
} else {
return pow(a, b);
}
Expand Down Expand Up @@ -47273,7 +47273,7 @@ static uint32_t map_hash_key(JSContext *ctx, JSValue key)
d = JS_VALUE_GET_FLOAT64(key);
/* normalize the NaN */
if (isnan(d))
d = JS_FLOAT64_NAN;
d = NAN;
hash_float64:
u.d = d;
h = (u.u32[0] ^ u.u32[1]) * 3163;
Expand Down
7 changes: 3 additions & 4 deletions quickjs.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ enum {
/* any larger tag is FLOAT64 if JS_NAN_BOXING */
};

#define JS_FLOAT64_NAN NAN
#define JSValueConst JSValue /* For backwards compatibility. */

#if defined(JS_NAN_BOXING) && JS_NAN_BOXING
Expand Down Expand Up @@ -210,7 +209,7 @@ static inline JSValue JS_MKVAL(int64_t tag, int32_t int32)
static inline JSValue JS_MKNAN(void)
{
JSValue v;
v.u.float64 = JS_FLOAT64_NAN;
v.u.float64 = NAN;
v.tag = JS_TAG_FLOAT64;
return v;
}
Expand All @@ -221,7 +220,7 @@ static inline JSValue JS_MKNAN(void)
#else
#define JS_MKPTR(tag, p) (JSValue){ (JSValueUnion){ .ptr = p }, tag }
#define JS_MKVAL(tag, val) (JSValue){ (JSValueUnion){ .int32 = val }, tag }
#define JS_NAN (JSValue){ (JSValueUnion){ .float64 = JS_FLOAT64_NAN }, JS_TAG_FLOAT64 }
#define JS_NAN (JSValue){ (JSValueUnion){ .float64 = NAN }, JS_TAG_FLOAT64 }
#endif

#define JS_TAG_IS_FLOAT64(tag) ((unsigned)(tag) == JS_TAG_FLOAT64)
Expand Down Expand Up @@ -813,7 +812,7 @@ JS_EXTERN bool JS_DetectModule(const char *input, size_t input_len);
/* 'input' must be zero terminated i.e. input[input_len] = '\0'. */
JS_EXTERN JSValue JS_Eval(JSContext *ctx, const char *input, size_t input_len,
const char *filename, int eval_flags);
JS_EXTERN JSValue JS_Eval2(JSContext *ctx, const char *input, size_t input_len,
JS_EXTERN JSValue JS_Eval2(JSContext *ctx, const char *input, size_t input_len,
JSEvalOptions *options);
JS_EXTERN JSValue JS_EvalThis(JSContext *ctx, JSValue this_obj,
const char *input, size_t input_len,
Expand Down