Hey guys!

i’m very new to Big Decimal

i attempting to calculate mandelbrot set with high precision for ultra zoom capability, so i’m using Big Decimal to perform calculation.

while calculating, the loop slows down. i suspected the problem is in BigDecimal method. looks like it performs a long decimal calculation, the decimal become bigger and bigger so it slowing down. but how is this happened? i have tried some ways like flooring it, but it couldn’t solve the problem

here the simplified codes:

```
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
MathContext mc = new MathContext(2, RoundingMode.FLOOR);
int maxIter = 100;
void setup() {
BigDecimal x0 = new BigDecimal("2");
BigDecimal y0 = new BigDecimal("1");
BigDecimal x = new BigDecimal("0");
BigDecimal y = new BigDecimal("0");
int iteration = 0;
// the loop slowing down
while (iteration < maxIter) {
BigDecimal xTemp = x.multiply(x).subtract(y.multiply(y)).add(x0); // = xTemp = x*x - y*y + x0 : am i doing it right?
y = x.multiply(y).multiply(new BigDecimal("2")).add(y0); // = y = x*y*2 + y0;
x = xTemp;
//println(xTemp); // the decimal become bigger and bigger, it slows the process
// the loop slowing down at ~22 loop
println(iteration);
iteration++;
}
println("DONE!"); // this line should be executed
}
```

I have no clue how is this happened. Any help would be appreciated!