Index: src/conversions-inl.h |
diff --git a/src/conversions-inl.h b/src/conversions-inl.h |
index bac15768270f4fe0808c31332e261dac81312dce..ae87dc4d31b01763eef756a1058a05ca0dc1561e 100644 |
--- a/src/conversions-inl.h |
+++ b/src/conversions-inl.h |
@@ -67,6 +67,14 @@ inline unsigned int FastD2UI(double x) { |
} |
+inline float DoubleToFloat32(double x) { |
+ // TODO(yanggou): This static_cast is implementation-defined behaviour in C++, |
+ // so we may need to do the conversion manually instead to match the spec. |
+ volatile float f = static_cast<float>(x); |
+ return f; |
+} |
+ |
+ |
inline double DoubleToInteger(double x) { |
if (std::isnan(x)) return 0; |
if (!std::isfinite(x) || x == 0) return x; |