Description
This code:
import static java.lang.Math.* R = 1; C1 = 0.4; C2 = 0.9; C3 = 6 //niters = getInt("How many iterations of the Ikeda map"); niters = 200000 x = new double[niters] y = new double[niters] x[0]=0.12; y[0]=0.2 k=1 km=0 tau=0.0; sintau=0.0; costau=0.0 while (k< niters) { km=k-1 tau = C1-C3/(1+x[km]*x[km]+y[km]*y[km]) sintau = sin(tau); costau = cos(tau); x[k] = R+C2*(x[km]*costau-y[km]*sintau) y[k] = C2*(x[km]*sintau+y[km]*costau) k++ }
fails with a cast exception complaining it cannot cast BigDecimal to double. The reason is that C1 - (C3/(1+x[km]*x[km]+y[km]*y[km])) is a BigDecimal-Double operation, for which a double,double method will be selected. This requires a transformation of the receiver from BigDecimal to double. The current code does this only for the arguments.