RE: [PHP] Representing microtime() values
| From: | Zoltán Németh | Date: | Tue, 27 Nov 2007 08:41:23 +0000 |
| Subject: | RE: [PHP] Representing microtime() values | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-265052@lists.php.net to get a copy of this message | ||
2007. 11. 27, kedd keltezéssel 09.46-kor Tomi Kaistila ezt írta:
> >>Hi everyone
> >>
> >>Here's a small problem that I haven't been able to figure out and hence I
> >>figured I'd post and see if anyone can explain this to me.
> >>
> >>-snip-
> >>
> >How exactly does PHP handle these values internally? Does anyone know?
> >
> >Tomi:
> >
> >Try this:
> >
> >http://www.webbytedd.com/b/timed/
> >
> >HTH's
> >
> >tedd
>
> Thanks Tedd, but that's not really what I asked for. The difference in your
> script is that it doesn't use the TRUE flag (unlike the script given on
> PHP's manual). But not much of anything else. PHP still behaves the same way
> with the float numbers when you try to look at them. And that is the part
> that I wish to understand.
>
> PHP clearly stores a number with more than two decimal points when you call
> microtime(). But when you print it, it only shows two.
that seems to me like a floating point precision issue. after all, the
integer part of the microtime result is a quite big number...
I even tried a workaround like
$a = explode(' ', microtime());
echo $a[0] + $a[1];
but it resulted in the exact same result like microtime(true)
anyone knows something for sure?
greets
Zoltán Németh
>
> Why is this?
>
>
> Tomi Kaistila
> PHP Developer
>