// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.math.BigDecimal;

public class FPFun {
    public static void main(String[] args) {
        double x = 0.4;
        for(int i = 0; i < 10; i++) {
            System.out.println(x);
            x += 0.01;
        }
        double xx = 0.4;
        for(int i = 0; i < 10; i++) {
            System.out.printf("%.2f\n", xx);
            xx += 0.01;
        }
        BigDecimal xxx = (new BigDecimal("0.4")).setScale(2);
        BigDecimal d = (new BigDecimal("0.01")).setScale(2);
        for(int i = 0; i < 10; i++) {
            System.out.println(xxx);
            xxx = xxx.add(d);
        }
    }
}
