Last active
March 3, 2016 23:55
-
-
Save CampingScorpion/bdf9a25ecaf5162a6529 to your computer and use it in GitHub Desktop.
remove scientific notation for floats
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn drop-trailing-zeros [^String s] | |
(.replaceFirst s "\\.0*$|(\\.\\d*?)0+$" "$1")) | |
(defmethod print-method Number [o, ^Writer w] | |
(if (float? o) | |
(.write w (drop-trailing-zeros (format "%.99f" o))) | |
(.write w (str o)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment