fix(dynamic-typing): accept an explicit leading plus sign on numbers
The FLOAT gate in testFloat allowed only a minus sign on the mantissa, while the exponent right after it already allowed either sign. dynamicTyping therefore left +42 and +1.5E-03 as strings and converted -42 and -1.5E-03, silently producing columns that mix numbers and strings depending on how each row wrote its sign. parseFloat already accepts a leading plus and returns the right value, so the regex was stricter than the conversion it guards. Allow either sign on the mantissa, matching the exponent. The 2^53 precision guard is unchanged, and a plus that is not a sign is still rejected. Fixes #1070
This commit is contained in:
1 parent
b604b5b84b
commit
378043f104
2 files changed
+19
-1
No files matched your search
+1
-1
@@ -966,7 +966,7 @@ License: MIT
|
||||
// One goal is to minimize the use of regular expressions...
|
||||
var MAX_FLOAT = Math.pow(2, 53);
|
||||
var MIN_FLOAT = -MAX_FLOAT;
|
||||
var FLOAT = /^\s*-?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/;
|
||||
var FLOAT = /^\s*[-+]?(\d+\.?|\.\d+|\d+\.\d+)([eE][-+]?\d+)?\s*$/;
|
||||
var ISO_DATE = /^((\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z))|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+-][0-2]\d:[0-5]\d|Z)))$/;
|
||||
var self = this;
|
||||
var _stepCounter = 0; // Number of times step was called (number of rows parsed)
|
||||
|
||||
Reference in new issue
Block a user