<< Back to previous view

[CLJ-923] Reading ratios prefixed by + is not working Created: 03/Feb/12  Updated: 18/Aug/12  Resolved: 18/Aug/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.2, Release 1.3, Release 1.4
Fix Version/s: Release 1.5

Type: Defect Priority: Major
Reporter: Cosmin Stejerean Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: Text File clj-923-reading-ratios-prefixed-by-plus-patch2.txt    
Patch: Code and Test
Approval: Ok

 Description   

In general Clojure's number types can be read prefixed with either a +
or - and this seems to work correctly for reading integers and floats.
In the case of ratios however things break down when ratios are
prefixed with a +.

The ratio pattern in LispReader.java does match on ratios starting
with both + and - but matchNumber fails on ratios prefixed with +
because it ends up calling "new BigInteger(m.group(1))" and it turns
out the constructor for BigInteger has no problems with negative
numbers but it doesn't like numbers prefixed by a +.



 Comments   
Comment by Cosmin Stejerean [ 03/Feb/12 6:26 PM ]

added patch with fix and tests

Comment by Kevin Downey [ 24/Feb/12 4:02 PM ]

changes to the reader tests on master cause 0001-added-tests-for-reading-ratios-and-fixed-reading-of-.patch to no longer apply cleanly

Comment by Andy Fingerhut [ 24/Feb/12 4:21 PM ]

clj-923-reading-ratios-prefixed-by-plus-patch.txt applies cleanly to latest as of Feb 24, 2012 (2:20 PM PST

Comment by Andy Fingerhut [ 23/Mar/12 7:55 PM ]

clj-923-reading-ratios-prefixed-by-plus-patch2.txt still semantically same as Cosmin's original patch, except it applies, builds, and tests cleanly on latest master as of Mar 23, 2012. Context lines around patch must have changed recently.

Comment by Cosmin Stejerean [ 23/Mar/12 8:07 PM ]

Thanks for updating the patch. I've removed the original to make it clear which one we need.

Comment by Aaron Bedra [ 14/Aug/12 9:33 PM ]

Patch applies cleanly against 4004d267e124f12b65b0d7fb6522f32a75e3c4fb. Submitter is a confirmed CA signer.

Generated at Tue Oct 21 13:30:43 CDT 2014 using JIRA 4.4#649-r158309.