This topic is locked

Limit Average Digits

12/15/2005 2:48:07 PM
PHPRunner General questions
T
Tommy B author

How might I limit the number of digits returned using the average function. I want a whole number, not a decimal, or at most, one or two decimals. I'm ending up with repeating averages that add about 10 digits past the decimal (22.6666666667). Can I limit this?
This is the code from the functions include:

if($stype=="AVERAGE") return ($value/$iNumberOfRows);
Would it be editted here or on the list page? Maybe somewhere else? I'd appreciate any feedback.

Sergey Kornilov admin 12/16/2005

Tommy,
to limit the number if digits displayed please modify this snippet this way:

if($stype=="AVERAGE") return round($value/$iNumberOfRows,2);