<< 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


 Description   

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).



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

Fixed and released as 0.0.3

Generated at Wed Sep 17 18:40:15 CDT 2014 using JIRA 4.4#649-r158309.