| … | |
… | |
| 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 | |
| 110 | sub round { |
111 | sub 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 |
|
|
124 | sub 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 |
| 124 | sub lcm { |
131 | sub lcm { |