Skip to content

Commit 5bb1cc3

Browse files
authored
Merge pull request #36 from ionspin/big-decimal-string-conf
Added configuration parameter
2 parents 876ddda + 753a042 commit 5bb1cc3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ build/
1010
gradle.properties
1111
/buildSrc/out
1212
/bignum/node_modules
13+
/bignum/package.json

bignum/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"name": "kotlin-multiplatform-bignum-js",
3-
"version": "0.0.1",
4-
"description": "Kotlin Multiplatform BigNum",
5-
"main": "flow.js",
3+
"version" : "0.0.1",
4+
"description" : "Kotlin Multiplatform BigNum",
5+
"main" : "flow.js",
66
"author": "Ugljesa Jovanovic",
77
"license": "Apache 2.0",
88
"homepage": "",
99
"dependencies": {
10-
"kotlin": "1.3.20"
10+
"kotlin" : "1.3.20"
1111
},
1212
"devDependencies": {
1313
"mocha": "5.2.0"
1414
}
15-
}
15+
}

bignum/src/commonMain/kotlin/com/ionspin/kotlin/bignum/decimal/BigDecimal.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ class BigDecimal private constructor(
5959
val ONE = BigDecimal(BigInteger.ONE)
6060
val TWO = BigDecimal(BigInteger.TWO)
6161

62+
var useToStringExpanded : Boolean = false
63+
6264

6365
private fun roundOrDont(significand: BigInteger, exponent: BigInteger, decimalMode: DecimalMode): BigDecimal {
6466
return if (decimalMode.decimalPrecision != 0L && decimalMode.roundingMode != RoundingMode.NONE) {
@@ -1357,6 +1359,9 @@ class BigDecimal private constructor(
13571359
* i.e. 1.23E+9
13581360
*/
13591361
override fun toString(): String {
1362+
if (BigDecimal.useToStringExpanded) {
1363+
return toStringExpanded()
1364+
}
13601365
val significandString = significand.toString(10)
13611366
val modifier = if (significand < 0) {
13621367
2

0 commit comments

Comments
 (0)