Warning: Invalid argument supplied for foreach() in /home/jihswbiz/public_html/t6.gwilt.org/refDox.php on line 212
Docs-fix

 

ReLoad

Keys


Functions

arraybrowsercolorcookiedatetimeDBdebugdeviceDSTequiverrorflagsfontformatgeo
holidayhtmlisjsonmathparsePHPprintsearchsortstringtabletexttracetype
VOTDweatherxml

Function  fix   Lines 1118-1145 (27 lines)Added: 2021-02-19 file  utils.php   Last mod: Fri 2021-05-14 21:45:07

function fix $num$places=0$opt=)
        {
#-k     math equiv
#-      Because I'm fed up with trying to remember it's not fixed or float, and this is shorter and req's only 1 arg
#-p     $f      - req   - number to fix
#-p     $places - opt   - 0 (default) means INT, else number decimal places.
#-p     $opt    - opt   - 0 (default) treat as a regulat float or int
#-p                     - 1 trunc, not round (1.09 => 1.00)
#-p                     - 2 floor, not round (-1.3 => -2 not -1)
#-d     2/19/21 - Added
#-r     Supercedes: trunc
#-s     See also: rem is_uge is_ugt umax

        
switch ($opt)
                {
case 
0:                                                 # round
                
return round $num$places );
case 
1:                                                 # trunc
                
$i round($num,$places);
                
$f $num-$i;
                if ((
$num 0) && ($f 0)) $i=$i-1*pow(10,-$places);
                if ((
$num 0) && ($f 0)) $i=$i+1*pow(10,-$places);
                return 
$i;
case 
2:                                                 # floor
                
return floor $num );
                }
        }

?>