Re: docs for (double) related to (int) or ???
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 29 May 2009 23:04:33 -0400
J. Frank Parnell wrote:
On Fri, 29 May 2009 15:50:09 -0400, Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
wrote:
J. Frank Parnell wrote:hello, I inherited this:double is just a floating point value. But this code looks bad - if it's supposed to return the microtime in seconds, it should be
function microtime_float (){
list ($usec, $sec) = explode (' ', microtime ());
return (double)$usec + (double)$sec;
}
double seems to be related to int.
Can some one explain (double) or point to some docs or explanations?
thanks, J
return ((double)$usec) / 1000000 + double($sec);
well cool...but why double? isnt "double" ( $num * 2)? or did i miss something
in my extensive (read: high school. smirk) education?
the full usage of the function is much like in the php man(thanx yawnmoth):
$res_start = microtime_float();
//lotsa code
$res_stop = sprintf("%2f", microtime_float() - $res_start);
echo "Page load time: $res_stop seconds";
do you still believe the function to be bad?
No double is a commonly used term for floating point representations. For instance, in C, a float may use two bytes of storage, while a double could use four bytes (or four and eight, respectively). With more bits, you have higher precision. double has approximately twice the precision of a float.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- References:
- docs for (double) related to (int) or ???
- From: J . Frank Parnell
- Re: docs for (double) related to (int) or ???
- From: Jerry Stuckle
- Re: docs for (double) related to (int) or ???
- From: J . Frank Parnell
- docs for (double) related to (int) or ???
- Prev by Date: Re: Question on search script
- Next by Date: Every member will receive a single share when we incorporate.
- Previous by thread: Re: docs for (double) related to (int) or ???
- Next by thread: Re: docs for (double) related to (int) or ???
- Index(es):
Relevant Pages
|