PyClojure icon indicating copy to clipboard operation
PyClojure copied to clipboard

handle large integers

Open eigenhombre opened this issue 13 years ago • 3 comments

pyclojure: pylisp> (* 10000000 10000000000) 100000000000000000 pylisp> (* 10000000 1000000000999999999999999999999990) 10000000009999999999999999999999900000000 is unknown! (exits interpreter)

Clojure: user=> (* 10000000 1000000000999999999999999999999990) 10000000009999999999999999999999900000000 user=>

eigenhombre avatar Feb 15 '12 14:02 eigenhombre

(Ugh, sorry for the duplicate commit.... :'( Thought I needed to format my issue number differently.)

Not sure if I'm missing an edge case, but it satisfies my smoke tests.

pyclojure> (+ 1 1)
2
pyclojure> (* 9223372036854775808 2)
18446744073709551616L
pyclojure> (* 10000000 1000000000999999999999999999999990)
10000000009999999999999999999999900000000L

Thanks for starting this project!

drewr avatar Mar 28 '12 06:03 drewr

On second thought, if the Python long format is printed then it should be supported in the reader too. Let me try that.

drewr avatar Mar 28 '12 06:03 drewr

'L' breaks with Clojure's 'N' convention, but Python longs aren't clojure.lang.BigInts so perhaps a distinction is necessary?

drewr avatar Mar 28 '12 06:03 drewr