From 1f5f04dec72236a215f3d627fce27bbfe1d66cb2 Mon Sep 17 00:00:00 2001 From: Andy Fingerhut Date: Sun, 28 Oct 2012 17:47:37 -0700 Subject: [PATCH] MTOWER-2: Eliminate a few uses of reflection in math.numeric-tower --- src/main/clojure/clojure/math/numeric_tower.clj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/clojure/clojure/math/numeric_tower.clj b/src/main/clojure/clojure/math/numeric_tower.clj index e2dbc3a..d5821cf 100644 --- a/src/main/clojure/clojure/math/numeric_tower.clj +++ b/src/main/clojure/clojure/math/numeric_tower.clj @@ -226,7 +226,7 @@ For example, (exact-integer-sqrt 15) is [3 6] because 15 = 3^2+6." (if (zero? error) isqrt (Math/sqrt n))))) -(defn- sqrt-ratio [n] +(defn- sqrt-ratio [^clojure.lang.Ratio n] (if (neg? n) Double/NaN (let [numerator (.numerator n), denominator (.denominator n), @@ -243,6 +243,6 @@ For example, (exact-integer-sqrt 15) is [3 6] because 15 = 3^2+6." (let [frac (rationalize n), sqrtfrac (sqrt frac)] (if (ratio? sqrtfrac) - (/ (BigDecimal. (.numerator sqrtfrac)) - (BigDecimal. (.denominator sqrtfrac))) + (/ (BigDecimal. (.numerator ^clojure.lang.Ratio sqrtfrac)) + (BigDecimal. (.denominator ^clojure.lang.Ratio sqrtfrac))) sqrtfrac)))) -- 1.8.0