In the following program, the LCD will print 4999 first (incorrect), and then 5031 second (correct). I'm not missing something obvious am I?

import josx.platform.rcx.*;

public class Program {

    public static void main(String[] args) {
        present((int)(convert(10.25) * 10000));
        present((int)((10.25 * 2 * Math.PI / 128) * 10000));
    }

    private static double convert(double ticks) {
        return ticks * 2 * Math.PI / 128;
    }

    private static void present(int number) {
        LCD.showNumber(number);
        try {
            Button.PRGM.waitForPressAndRelease();
        } catch (InterruptedException e) {
        }
    }

}



Reply via email to