Login  Register

macro language bug in v1.44h?

Posted by Bill Christens-Barry on Sep 25, 2010; 12:07pm
URL: http://imagej.273.s1.nabble.com/macro-language-bug-in-v1-44h-tp3686799.html

The following macro code produces odd results using MacOS 10.6.4:

    macro "MaxBugDemo" {

        print("\\Clear");
        x = newArray("3.3", "4.4", "11.1", "33.3", "22.2", "9.9", "3.3");
        xmax = 3.5;
        x10max = 3.5;
        for (j = 0; j < lengthOf(x); j++) {
                if (x[j] > xmax)
                        xmax = x[j];
                if (10*x[j] > 10*xmax)
                        x10max = x[j];
                print(x[j] + "  " + xmax + "  " + x10max);
        }
    }

Output is:

    3.3  3.5  3.5
    4.4  4.4  3.5
    11.1  4.4  11.1
    33.3  4.4  33.3
    22.2  4.4  22.2
    9.9  9.9  22.2
    3.3  9.9  22.2

Same in 1.44i daily build. I wonder if this is this a string conversion issue.