[CLJ-1193] bigint, biginteger throw on double values outside of long range Created: 07/Apr/13 Updated: 14/Aug/13 Resolved: 14/Aug/13
|Fix Version/s:||Release 1.6|
|Patch:||Code and Test|
The bigint and biginteger functions throw on double values outside of long range
This works fine:
but passing any Float or Double values outside the range of a long throw an exception:
Cause: bigint and biginteger cover a series of possible input cases but did not have an explicit case for Float or Double, so was falling back to default.
Solution: Add check for Float/Double case that coerces the input to double, then uses BigDecimal.valueOf(), then converts to a BigInteger and so on as with other types.
|Comment by Andy Fingerhut [ 07/Apr/13 4:38 PM ]|
Patch clj-1197-make-bigint-work-on-all-doubles-v1.txt dated Apr 7 2013 changes bigint and biginteger so that they return the correct value for all float and double values, and no longer throw an exception.
|Comment by Gabriel Horner [ 17/May/13 10:52 AM ]|
Looks good. Tests pass and the failing example now converts correctly
|Comment by Alex Miller [ 08/Aug/13 1:51 AM ]|
Cleaned up the description a bit.