[system] / trunk / pg / macros / PGauxiliaryFunctions.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGauxiliaryFunctions.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1089 Revision 1090
104 104
105 $minVal; 105 $minVal;
106 106
107} 107}
108 108
109#round added 6/12/2000 by David Etlinger 109#round added 6/12/2000 by David Etlinger. Edited by AKP 3-6-03
110
110sub round { 111sub round {
111 my $input = shift; 112 my $input = shift;
112 my $out; 113 my $out = Round($input);
113 if( $input >= 0 ) { 114# if( $input >= 0 ) {
114 $out = int ($input + .5); 115# $out = int ($input + .5);
115 } 116# }
116 else { 117# else {
117 $out = ceil($input - .5); 118# $out = ceil($input - .5);
118 } 119# }
119 $out; 120 $out;
121}
122
123# Round contributed bt Mark Schmitt 3-6-03
124sub Round {
125 if (@_ == 1) { $_[0] > 0 ? int $_[0] + 0.5 : int $_[0] - 0.5}
126 elsif (@_ == 2) { $_[0] > 0 ? Round($_[0]*10**$_[1])/10**$_[1] :Round($_[0]*10**$_[1])/10**$_[1]}
120} 127}
121 128
122#least common multiple 129#least common multiple
123#VS 6/29/2000 130#VS 6/29/2000
124sub lcm { 131sub lcm {

Legend:
Removed from v.1089  
changed lines
  Added in v.1090

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9