I didn't see this as an open issue on the JIRA bug list, so I thought
I would ask about it here.

> (cl-format nil "~,5f" -434343.867071)
"-434343.86707"
> (cl-format nil "~,5f" -434343.867072)
"-434343.86707"
> (cl-format nil "~,5f" -434343.867075)

For input string: "43434386707"
  [Thrown class java.lang.NumberFormatException]

Backtrace:
  0: 
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
  1: java.lang.Integer.parseInt(Integer.java:461)
  2: java.lang.Integer.valueOf(Integer.java:554)
  3: clojure.pprint$round_str.invoke(cl_format.clj:585)


After looking at the round-str function, it appears that if round-char
>= 5, then result is parsed by Integer.valueOf(result), which causes
an exception if result is too large.  I rewrote part of it to use
BigInteger, and it seemed to fix the problem, but I didn't test it
extensively.  It might be a valid solution in any case.

Incidentally, I love using clojure.pprint.  It's powerful, and after
diving into the CLM spec I have new appreciation for the daunting task
it must be to test it.

-Travis

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to