Chromium Code Reviews| Index: Source/bindings/dart/DartUtilities.cpp |
| diff --git a/Source/bindings/dart/DartUtilities.cpp b/Source/bindings/dart/DartUtilities.cpp |
| index 9326acf8ac5292d6643a7773997d8daa950da27b..a79027f87443bd79f56eb6ea08ea895872f77dae 100644 |
| --- a/Source/bindings/dart/DartUtilities.cpp |
| +++ b/Source/bindings/dart/DartUtilities.cpp |
| @@ -50,6 +50,8 @@ |
| #include "core/platform/network/ResourceRequest.h" |
| #include "core/platform/sql/SQLValue.h" |
| +#include <math.h> |
| + |
| #include <wtf/ArrayBufferView.h> |
| #include <wtf/Float32Array.h> |
| #include <wtf/Float64Array.h> |
| @@ -281,8 +283,9 @@ unsigned long long DartUtilities::dartToUnsignedLongLong(Dart_Handle object, Dar |
| Dart_Handle DartUtilities::numberToDart(double value) |
| { |
| - int intValue = static_cast<int>(value); |
| - if (value == intValue) |
| + int64_t intValue = static_cast<int64_t>(value); |
| + // JS can store integer values that are no greater than 2^53. |
| + if (value == intValue && abs(intValue) <= pow(2, 53)) |
|
sra1
2013/10/17 21:40:31
I would avoid calling pow and define a constant
kM
Emily Fortuna
2013/10/17 22:42:51
Gotcha. Sorry I was going off of this: http://ecma
|
| return intToDart(intValue); |
| return doubleToDart(value); |
| } |