summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/src/Ice/BasicStream.js10
-rw-r--r--js/test/Ice/operations/Twoways.js23
2 files changed, 21 insertions, 12 deletions
diff --git a/js/src/Ice/BasicStream.js b/js/src/Ice/BasicStream.js
index 97e803c3ab3..548956fc158 100644
--- a/js/src/Ice/BasicStream.js
+++ b/js/src/Ice/BasicStream.js
@@ -2943,9 +2943,19 @@ Ice.IntHelper = defineBuiltinHelper(stream.writeInt, stream.readInt, 4, Ice.Opti
Ice.FloatHelper = defineBuiltinHelper(stream.writeFloat, stream.readFloat, 4, Ice.OptionalFormat.F4,
MIN_FLOAT32_VALUE, MAX_FLOAT32_VALUE);
+Ice.FloatHelper.validate = function(v)
+{
+ return Number.isNaN(v) || v == Number.POSITIVE_INFINITY || v == Number.NEGATIVE_INFINITY ||
+ (v >= MIN_FLOAT32_VALUE && v <= MAX_FLOAT32_VALUE);
+};
Ice.DoubleHelper = defineBuiltinHelper(stream.writeDouble, stream.readDouble, 8, Ice.OptionalFormat.F8,
-Number.MAX_VALUE, Number.MAX_VALUE);
+Ice.DoubleHelper.validate = function(v)
+{
+ return Number.isNaN(v) || v == Number.POSITIVE_INFINITY || v == Number.NEGATIVE_INFINITY ||
+ (v >= -Number.MAX_VALUE && v <= Number.MAX_VALUE);
+};
Ice.BoolHelper = defineBuiltinHelper(stream.writeBool, stream.readBool, 1, Ice.OptionalFormat.F1);
Ice.LongHelper = defineBuiltinHelper(stream.writeLong, stream.readLong, 8, Ice.OptionalFormat.F8);
diff --git a/js/test/Ice/operations/Twoways.js b/js/test/Ice/operations/Twoways.js
index a5c78738fe9..e7bbd6bedc0 100644
--- a/js/test/Ice/operations/Twoways.js
+++ b/js/test/Ice/operations/Twoways.js
@@ -180,27 +180,26 @@
function(ex)
{
test(ex instanceof Ice.MarshalException);
- return prx.opFloatDouble(0, Number.MAX_VALUE * 2);
+ return prx.opFloatDouble(Number.NaN, Number.NaN);
}
).then(
- failCB,
- function(ex)
+ function(retval, f, d)
{
- test(ex instanceof Ice.MarshalException);
- return prx.opFloatDouble(0, -Number.MAX_VALUE * 2);
+ return prx.opFloatDouble(-Number.NaN, -Number.NaN);
}
).then(
- failCB,
- function(ex)
+ function(retval, f, d)
{
- test(ex instanceof Ice.MarshalException);
- return prx.opFloatDouble(0, Number.NaN);
+ return prx.opFloatDouble(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY);
}
).then(
- failCB,
- function(ex)
+ function(retval, f, d)
+ {
+ return prx.opFloatDouble(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY);
+ }
+ ).then(
+ function(retval, f, d)
{
- test(ex instanceof Ice.MarshalException);
return prx.opString("hello", "world");
}
).then(