Index: src/platform-posix.cc |
diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
index 3bc83733ca21249808c74388dd98de6be4125497..1c65be226c385ffbe47305caf84e27c57e5a102a 100644 |
--- a/src/platform-posix.cc |
+++ b/src/platform-posix.cc |
@@ -149,7 +149,19 @@ UNARY_MATH_FUNCTION(sqrt, CreateSqrtFunction()) |
double OS::nan_value() { |
// NAN from math.h is defined in C99 and not in POSIX. |
+ |
+#if defined(V8_TARGET_ARCH_SH4) |
+ // Return a qNaN as expected by the v8 core. In sh4 tool chain, the NAN macro |
+ // is defined to be an sNaN while the C specifications require a qNaN. |
+ union { |
+ uint64_t ui64; |
+ double d; |
+ } value; |
+ value.ui64 = (static_cast<uint64_t>(0x7ff00000) << 32) | 0x00000001; |
+ return value.d; |
+#else |
return NAN; |
+#endif |
} |