Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • 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).

        Attachments

          Activity

            People

            • Assignee:
              markengelberg Mark Engelberg
              Reporter:
              alex+import import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: