“The Joy of Clojure” says not to rationalize values that are Java float or double primitives.
Why not rationalize them but it is ok to rationalize instances of java.lang.Float and java.lang.Double?
[EDIT]
The book (page 67) doesn’t suggest it is ok to rationalize java.lang.Float or java.lang.Double but it shows an example:
(def a (rationalize 1.0e50))
(def b (rationalize -1.0e50))
(def c (rationalize 17.0e00))
So, is there a difference between rationalizing a double v.s. a Double (or a float v.s. a Float)? No, not really. You’re going to end up with a Ratio object in either case, and you’re going to have the same performance characteristics when doing lots of math on that type.
e.g.
Still though, if you need that sort of accuracy, then that would be the way to go. But if you can use standard computer floating point arithmetic, then you’ll be better off because this will translate much more directly into machine instructions than working with Ratio objects will.