[CLJ-937] cl-format prints ratio arguments with bad format for E, F, G directives Created: 21/Feb/12 Updated: 25/Oct/13 Resolved: 25/Oct/13
|Affects Version/s:||Release 1.3, Release 1.4|
|Fix Version/s:||Release 1.6|
|Attachments:||cl-format-efg-coerce-ratios-to-doubes-patch1.txt clj-937-cl-format-coerces-ratios-patch2.diff clj-937-cl-format-coerces-ratios-patch2.txt|
|Patch:||Code and Test|
Approach: Patch changes cl-format so that when E, F, or G directive is used, the corresponding arg is coerced from a clojure.lang.Ratio to a double before formatting, if it fits in a double, otherwise a BigDecimal if the extra precision is needed.
Screened by: Alex Miller
|Comment by Tom Faulhaber [ 29/Mar/12 8:48 PM ]|
I have reviewed this patch and recommend that it be applied.
(This one has actually been on my to do list for about 4 years. Thanks, Andy!)
|Comment by Andy Fingerhut [ 08/Apr/13 12:02 PM ]|
Patch clj-937-cl-format-coerces-ratios-patch2.txt dated Apr 8 2013 supersedes the previous patch cl-format-efg-coerce-ratios-to-doubes-patch1.txt dated Feb 21 2013.
The newer patch works with ratios that cannot be represented as a double, using BigDecimal in those cases. The older patch would print garbage from the string "Infinity" if the ratios were larger than Double/MAX_VALUE, or 0 if the ratio was between 0 and Double/MIN_VALUE.
|Comment by Andy Fingerhut [ 03/Sep/13 1:57 PM ]|
Replace patch clj-937-cl-format-coerces-ratios-patch2.txt with another one of the same name. The only change is to eliminate trailing whitespace from some of the lines added by the patch, which eliminates the warnings that occur when git is used to apply the patch.