<< Back to previous view

[MTOWER-4] Typo in sqrt-ratio Created: 20/Dec/13  Updated: 29/Dec/13  Resolved: 29/Dec/13

Status: Closed
Project: math.numeric-tower
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Olivier Miel Assignee: Mark Engelberg
Resolution: Completed Votes: 0
Labels: None


sqrt-ratio checks twice if sqrtnum is a floating-point number:

(defn- sqrt-ratio [^clojure.lang.Ratio n]
  (if (neg? n) Double/NaN
    (let [numerator (.numerator n),
          denominator (.denominator n),
          sqrtnum (sqrt numerator)]
      (if (float? sqrtnum)
        (Math/sqrt n)
        (let [sqrtden (sqrt denominator)]
          (if (float? sqrtnum)
            (Math/sqrt n)
            (/ sqrtnum sqrtden)))))))

The second check should be a check for the type of sqrtden or the check(s) should be removed (and let / do the job).

Comment by Mark Engelberg [ 29/Dec/13 8:11 PM ]

Fixed and released as 0.0.3

Generated at Sat Mar 23 09:49:28 CDT 2019 using JIRA 4.4#649-r158309.