diff options
| author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2024-12-18 15:31:58 +0330 | 
|---|---|---|
| committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2024-12-18 15:31:58 +0330 | 
| commit | c11cf500bee8e5dbe1c794b89bcb64f48f40f441 (patch) | |
| tree | f21f1e1be9d96ea239672356b727c626ded0fda7 /app/src/main | |
| parent | 9313767a800f16e01a05c577183b5e6399c3f76d (diff) | |
fixed division
Diffstat (limited to 'app/src/main')
| -rw-r--r-- | app/src/main/java/com/a404m/calculator/util/MathHelper.kt | 13 | 
1 files changed, 2 insertions, 11 deletions
diff --git a/app/src/main/java/com/a404m/calculator/util/MathHelper.kt b/app/src/main/java/com/a404m/calculator/util/MathHelper.kt index 77244b0..51aec93 100644 --- a/app/src/main/java/com/a404m/calculator/util/MathHelper.kt +++ b/app/src/main/java/com/a404m/calculator/util/MathHelper.kt @@ -180,7 +180,7 @@ object MathHelper {                              value = expression.substring(                                  start,                                  i -                            ).toBigDecimal() +                            ).toBigDecimal().multiply(BigDecimal("1.0"))                          )                      )                      --i @@ -310,16 +310,7 @@ object MathHelper {          val value: MathNumberType,      ) {          override fun toString(): String { -            var str = value.toString() -            if(str.contains('.')){ -                while (str.last() == '0'){ -                    str = str.removeRange(str.length-1,str.length) -                } -                if(str.last() == '.'){ -                    str = str.removeRange(str.length-1,str.length) -                } -            } -            return str +            return value.stripTrailingZeros().toString()          }      }  |