I noticed today that a series of digits with a trailing decimal point are read by Clojure as an Integer.

        user=> (class 123.)
        java.lang.Integer

In contrast, Java reads such a number as a double.

        % javac Foo.java
        Foo.java:5: possible loss of precision
        found   : double
        required: int
                    int a = 123.;
                            ^
        1 error

Another place this comes up is with a number formatted as 123.e4. Currently that's an invalid number in Clojure:

        user=> (class 123.e4)
        java.lang.NumberFormatException: Invalid number: 123.e4
        java.lang.Exception: Unmatched delimiter: )
        user=>

Java reads it as 1230000.0

To bring Clojure in line with Java for numbers formatted this way, I propose changing the reader to match Java's behavior for these cases. I have a patch which I'll attach to an issue if one is approved.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to