handle exponential floats
Fix for #15
Hope it won't affect performance significantly
Good catch! However, I don't think we can regex evaluate all numbers to cover the scientific notation case. Is there another way to distinguish them?
There should be a cut-off where it is represented with those notions. However, I'm not sure that is platform agnostic. Regardless I think we'll have to find another approach for them as the regex at this very hot path is not really feasible I think.
I haven't done any benchmarks, but i think it's valid concern...
According to this reference
All numbers in Javascript are 64bit (8 bytes) floating point numbers which yields an effective range of 5e-324 (negative) to 1.7976931348623157e+308 (positive) at the time this article was written (this may eventually change to 128 bits in the future as 64 bit processors become commonplace and the ECMA standards evolve).
JS numbers seems to be platform agnostic, but i wouldn't rely on internal Number implementation because it may change.
There is Number.prototype.toExponential method that seems to return the same result as toString for exponential numbers
So using something kinda if (Number.isInteger(obj) && obj.toString() !== obj.toExponential()) seems reasonable. I'll update the PR
added few optimizations
any more concerns here?