store/[org.clojure/clojure "1.8.0"] clj::clojure.core/rationalize

Official Documentation

Add notes
Arities
==================================================
   [num]

Docstring
==================================================
  returns the rational value of num

Source

(defn rationalize
  "returns the rational value of num"
  {:added "1.0"
   :static true}
  [num]
  (. clojure.lang.Numbers (rationalize num)))

Example 1

Edit
(rationalize Math/PI)
;; => 3141592653589793/1000000000000000

(rationalize (Math/sqrt 2))
;; => 14142135623730951/10000000000000000

Example 2

Edit
(rationalize 1.5)
;; => 3/2

Uses on crossclj