[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lujit - Malformed number
- From: Florian Weimer <fw@...>
- Date: Sat, 04 Sep 2010 21:22:20 +0200
* Mike Pall:
> Anyway, since the only popular decimal point besides '.' is ',',
> I could add a heuristic workaround for that. Except that it would
> slow down number parsing if a non-C locale is set (and uglify the
> code a lot). Or write my own replacement for strtod(), which is
> far from trivial, but would solve other compatibility problems.
There is dtoa for this purpose, see: <http://www.netlib.org/fp/>
It's quite portable.
What I would like to see is that n = tonumber(tostring(n)) holds for
all finite numbers, and that tostring(n) returns the shortest possible
representation such that n = tonumber(tostring(n)) holds. I believe
the Python folks put a bit of effort into that recently (in version
3.1 at least).