It is limited only by default. Frankly, I see no reason why it is not double precision by default...
Because in most applications you don't need more than single precision. And to make all pike applications take 50% more memory for that reason would not be something I would like.
This way I've one extra syscall, and interpeted: three float operations, two function calls and two svalues allocation/deallocation (= subject to gc()).
Go with his first suggenstion then and establish a base time. Then you'll only have one syscall extra for the entire run of the application. As for the rest, CPUs are fast. It is 21st century, after all. Besides, you can't hold a reference to an int or a float, so it is not subject to gc().
/ Martin Nilsson (saturator)
Previous text:
2003-09-19 01:05: Subject: Re: time() and optimization again
On Thu, Sep 18, 2003 at 11:00:05PM +0200, Fredrik (Naranek) Hubinette (Real Build Master) @ Pike (-) developers forum wrote:
time() was implemented this way *because* of the limited float precision. Basically, you are supposed to do this:
It is limited only by default. Frankly, I see no reason why it is not double precision by default...
int mstime() // Time in milliseconds { int t=time(); float off=time(t); return (off * 1000) + (t * 1000); }
This way I've one extra syscall, and interpeted: three float operations, two function calls and two svalues allocation/deallocation (= subject to gc()).
Not a big deal? Well, then again, I see no reason why default float type is not double precision... :)
Regards, /Al
/ Brevbäraren