Last active
March 3, 2016 23:55
-
-
Save CampingScorpion/bdf9a25ecaf5162a6529 to your computer and use it in GitHub Desktop.
Revisions
-
AlexBaranosky revised this gist
Mar 3, 2016 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,5 @@ (defn drop-trailing-zeros [^String s] (.replaceFirst s "\\.0*$|(\\.\\d*?)0+$" "$1")) (defmethod print-method Number [o, ^Writer w] (if (float? o) -
AlexBaranosky created this gist
Mar 3, 2016 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ (defn drop-trailing-zeros [s] (->> s reverse (drop-while #{\0}) reverse (apply str))) (defmethod print-method Number [o, ^Writer w] (if (float? o) (.write w (drop-trailing-zeros (format "%.99f" o))) (.write w (str o))))