lua-users home
lua-l archive

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

All I want to please is the Lua engine itself, really, and for that this code (bugs aside) seems sufficient. It goes hand-in-hand with the two places where I suggested using 'number2str()'.

I'd be delighted if my little codie gets into the 'etc/' or something in future Lua. :)

30.11.2004 kello 12:26, Luiz Henrique de Figueiredo kirjoitti:

 As part of my ARM-linux adaptation work (see other msg) I did the
attached 'float2str()' code.  It's a quickie, and I'd want to replace
it with (a similar sized) tested & proven Open Source approach. But is
there any?

Floating-point -> text conversion is not a light job. Of course, in your application, you may be able to get away with simple code, but in general.
if you want to have reversible conversions, then there's a lot to do.

Having said that, a simple and small code for floating-point -> text conversion
would be ideal for Lua installations that don't or can't use libc.

Try for excellent-quality, but large, code.
(There's even some code by Rob Pike and Ken Thompson.)