lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

In message <>, Luiz Henrique de Fig
ueiredo writes:
> (If someone knows a fast, small, portable function that converts floating-poi
> numbers to strings such that converting the string back to a number gives the
> *same* number, please let me know. I know about the ones by David Gay in netl
> but they're too complicated.)

Every version of printf that I've seen the source to and that works (in
particular has the property you describe) uses David Gay's netlib code.
That what FreeBSD uses for example.

There are plenty of versions of printf out there that don't work (they
don't satisfy the reading back a printed number gives the same number
property).  Presumably the code for such versions is smaller.

If you want to remove sprintf I suggest you use David Gay's code.  It's
what every decent printf uses in any case.