frac 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/frac.rb +1 -1
- metadata +2 -2
data/lib/frac.rb
CHANGED
@@ -5,6 +5,6 @@ module Math
|
|
5
5
|
# Find rational approximation to given real number.
|
6
6
|
def self.frac(float, prec)
|
7
7
|
arr = find_fracs(float, prec)
|
8
|
-
arr[2] > arr[5] ? Rational(arr[3], arr[4]) : Rational(arr[0], arr[1])
|
8
|
+
arr[2].abs > arr[5].abs ? Rational(arr[3], arr[4]) : Rational(arr[0], arr[1])
|
9
9
|
end
|
10
10
|
end
|