Skip to content

Commit 049b744

Browse files
authored
Add files via upload
1 parent 214d03c commit 049b744

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

AdvDiv.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ String times10(String nstring) {
55
return nstring.split(".")[0]+nstring.split(".")[1][0]+"."+nstring.split(".")[1].substring(1);
66
return nstring+"0";
77
}
8-
String? advdiv(double n1d, double n2d, int ri, [final String rstr1 = "[", final String rstr2 = "]"]) {
8+
String? advdiv(double n1d, double n2d, [int ri = 0, final String rstr1 = "[", final String rstr2 = "]"]) {
99
bool over = false;
1010
int carry = 0, newcarry = 0, x, d;
1111
int? rcount = null;
@@ -25,6 +25,10 @@ String? advdiv(double n1d, double n2d, int ri, [final String rstr1 = "[", final
2525
r = ri.toString();
2626
n1string = n1d.toString();
2727
n2string = n2d.toString();
28+
if(n1string.endsWith(".0"))
29+
n1string = n1string.replaceAll(".0", "");
30+
if(n2string.endsWith(".0"))
31+
n2string = n2string.replaceAll(".0", "");
2832

2933
while(n1string.contains(".") || n2string.contains(".")) {
3034
if(!n1string.contains(".")) {
@@ -41,6 +45,10 @@ String? advdiv(double n1d, double n2d, int ri, [final String rstr1 = "[", final
4145
};
4246
};
4347
n2string = times10(n2string);
48+
if(n1string.endsWith(".0"))
49+
n1string = n1string.replaceAll(".0", "");
50+
if(n2string.endsWith(".0"))
51+
n2string = n2string.replaceAll(".0", "");
4452
};
4553

4654
n1 = int.parse(n1string);

0 commit comments

Comments
 (0)