Reading ratios prefixed by + is not working

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 +.

Environment

None

Attachments

1
  • 24 Mar 2012, 01:55 AM

Activity

Show:

Aaron Bedra August 15, 2012 at 3:33 AM

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

Cosmin Stejerean March 24, 2012 at 2:07 AM

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

Andy Fingerhut March 24, 2012 at 1:55 AM

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.

Andy Fingerhut February 24, 2012 at 10:21 PM

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

Kevin Downey February 24, 2012 at 10: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

Completed

Details

Assignee

Reporter

Approval

Patch

Priority

Fix versions

Created February 4, 2012 at 12:06 AM
Updated August 18, 2012 at 1:12 PM
Resolved August 18, 2012 at 1:12 PM