mirror of
https://github.com/nodejs/node.git
synced 2025-08-16 06:08:50 +02:00
Revert "buffer: added support for writing NaN and Infinity"
This reverts commit 6b9425fe37
.
This commit is contained in:
parent
6c5fdd5223
commit
37f0eb8df3
3 changed files with 3 additions and 109 deletions
|
@ -1002,14 +1002,10 @@ function verifsint(value, max, min) {
|
|||
assert.ok(Math.floor(value) === value, 'value has a fractional component');
|
||||
}
|
||||
|
||||
function verifyIEEE754(value, max, min) {
|
||||
function verifIEEE754(value, max, min) {
|
||||
assert.ok(typeof (value) == 'number',
|
||||
'cannot write a non-number as a number');
|
||||
|
||||
if (isNaN(value) || value === Infinity || value === -Infinity) {
|
||||
return;
|
||||
}
|
||||
|
||||
assert.ok(value <= max, 'value larger than maximum allowed value');
|
||||
|
||||
assert.ok(value >= min, 'value smaller than minimum allowed value');
|
||||
|
@ -1116,7 +1112,7 @@ function writeFloat(buffer, value, offset, isBigEndian, noAssert) {
|
|||
assert.ok(offset + 3 < buffer.length,
|
||||
'Trying to write beyond buffer length');
|
||||
|
||||
verifyIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38);
|
||||
verifIEEE754(value, 3.4028234663852886e+38, -3.4028234663852886e+38);
|
||||
}
|
||||
|
||||
require('buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian,
|
||||
|
@ -1145,7 +1141,7 @@ function writeDouble(buffer, value, offset, isBigEndian, noAssert) {
|
|||
assert.ok(offset + 7 < buffer.length,
|
||||
'Trying to write beyond buffer length');
|
||||
|
||||
verifyIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308);
|
||||
verifIEEE754(value, 1.7976931348623157E+308, -1.7976931348623157E+308);
|
||||
}
|
||||
|
||||
require('buffer_ieee754').writeIEEE754(buffer, value, offset, isBigEndian,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue