diff options
Diffstat (limited to 'JavaScriptCore/API')
-rw-r--r-- | JavaScriptCore/API/JSValueRef.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/JavaScriptCore/API/JSValueRef.cpp b/JavaScriptCore/API/JSValueRef.cpp index a29a207..c22e8d8 100644 --- a/JavaScriptCore/API/JSValueRef.cpp +++ b/JavaScriptCore/API/JSValueRef.cpp @@ -213,6 +213,12 @@ JSValueRef JSValueMakeNumber(JSContextRef ctx, double value) ExecState* exec = toJS(ctx); APIEntryShim entryShim(exec); + // Our JSValue representation relies on a standard bit pattern for NaN. NaNs + // generated internally to JavaScriptCore naturally have that representation, + // but an external NaN might not. + if (isnan(value)) + value = NaN; + return toRef(exec, jsNumber(exec, value)); } |