[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Floating point performance (was Re: compiling LUA for uClinux)
- From: Mike Pall <mikelu-0504@...>
- Date: Wed, 6 Apr 2005 13:59:19 +0200
Hi,
Adam D. Moss wrote:
> On a similar note, poking around in luaconf.h I tried turning
> lua_number2str()'s sprintf() into a gcvt() to see if that
> gained anything. But it was actually slightly slower than
> sprintf() (which was a bit surprising because intuitively sprintf
> has to do more work, but sprintf has probably been subject to more
> optimization).
$ man gcvt | ul -Tunknown | grep -A2 NOTES
NOTES
This function is obsolete. Instead, sprintf() is recommended.
$ tail -9 glibc-2.3.3/misc/efgcvt.c
char *
APPEND (FUNC_PREFIX, gcvt) (value, ndigit, buf)
FLOAT_TYPE value;
int ndigit;
char *buf;
{
sprintf (buf, "%.*" FLOAT_FMT_FLAG "g", MIN (ndigit, NDIGIT_MAX), value);
return buf;
}
Bye,
Mike