--------
In message <[email protected]>, Nils Goroll 
writes:

>>      printf("%ju.%06ju",
>>              (uint64_t)floor(foo),
>>              (uint64_t)floor((foo*1e6)) % 1000000UL);
>
>nice trick. On Linux, this gets us down to the same order of magnitude as a
>%lu.%06lu with uint64_t

The important thing here is the FP rendering, not the FP math, which is
instantaneous for all practical purposes.

It's kind of surprising to me that "%.<N>f" hasn't gotten specific
optimization, it is a lot simpler thing than the general FP formatting
problem, but if there is any code I'm not keen on wading into, it is
FP formatting code...

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
[email protected]         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to