ionspin / kotlin-multiplatform-bignum

A Kotlin multiplatform library for arbitrary precision arithmetics
Apache License 2.0
366 stars 42 forks source link

Resolves #130 Fixes to BigDecimal doubleValue() and fromDouble() #131

Closed skolson closed 4 years ago

skolson commented 4 years ago

Resolves #130 - Fix to fromDouble companion function, which had a line attempting to remove extraneous trailing zeroes, which was not previously checking foe the presence of an exponent in the double string. This lead to wrong results when the exponent is present and ends in one or more zeroes (10, 20, 100, -10, etc...) Also doubleValue() previously could return a double with wrong exponent in some cases.

ionspin commented 4 years ago

Hey Steven, looks great, thanks for the contribution!