On Dec 4, 7:42 am, Glen Rubin <rubing...@gmail.com> wrote: > (range 0.05 0.16 0.01) > > user> (0.05 0.060000000000000005 0.07 0.08 0.09 0.09999999999999999 > 0.10999999999999999 0.11999999999999998 0.12999999999999998 > 0.13999999999999999 0.15)
You are seeing an artifact of the fact that floating point numbers cannot exactly represent decimal numbers. The repl is printing out the full precision of the numbers. If you are interested in formatting the numbers nicely, you can do something like this: user> (map #(format "%.2f" %1) (range 0.05 0.16 0.01)) ("0.05" "0.06" "0.07" "0.08" "0.09" "0.10" "0.11" "0.12" "0.13" "0.14" "0.15") Doing math with floating point numbers is generally fine, unless you have need for very high accuracy. Just format the final output when you want to display it. mch -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en