[OpenJDK Rasterizer] RFR: Marlin renderer #2

Laurent Bourgès bourges.laurent at gmail.com
Tue Jun 9 21:49:03 UTC 2015


Jim,

I sent by mistake the wrong alternative floor / ceil implementations:
the NaN case was buggy (wrong not) !

Here are my test output (CHECK_OVERFLOW = true):
floats       = [-2.13422758E9, -1.37992608E8, -134758.4, -131.5, -17.2,
-1.9, -0.9, -1.0E-4, -1.0E-8, -1.0E-23, -100.0, -3.0, -1.0, -0.0, 0.0, 0.0,
1.0, 3.0, 100.0, 131.5, 17.2, 1.9, 0.9, 1.0E-4, 1.0E-8, 1.0E-23,
2.13422758E9, 1.37992608E8, 134758.4, NaN, -Infinity, -5.0E20, 5.0E20,
Infinity]

mathCeil         = [-2134227584, -137992608, -134758, -131, -17, -1, 0, 0,
0, 0, -100, -3, -1, 0, 0, 0, 1, 3, 100, 132, 18, 2, 1, 1, 1, 1, 2134227584,
137992608, 134759, 0, -2147483648, -2147483648, 2147483647, 2147483647]

floatMathCeilAlt = [-2134227584, -137992608, -134758, -131, -17, -1, 0, 0,
0, 0, -100, -3, -1, 0, 0, 0, 1, 3, 100, 132, 18, 2, 1, 1, 1, 1, 2134227584,
137992608, 134759, 0, -2147483648, -2147483648, 2147483647, 2147483647]

Here are the correct ones:

    // Cast alternative (exact)

    private static int ceil_f_cast(final float a) {
        if (CHECK_OVERFLOW && Float.isNaN(a)) {
            return 0;
        }
        final int intpart = (int)a;

        if (a <= intpart || (CHECK_OVERFLOW && intpart ==
Integer.MAX_VALUE)) {
            return intpart;
        }
        return intpart + 1;
    }

    private static float floor_f_cast(final float a) {
        if (CHECK_OVERFLOW && Float.isNaN(a)) {
            return a;
        }
        final int intpart = (int)a;

        if (a >= intpart || (CHECK_OVERFLOW && intpart ==
Integer.MIN_VALUE)) {
            return intpart;
        }
        return intpart - 1;
    }

Sorry again,
Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/graphics-rasterizer-dev/attachments/20150609/fff7f02c/attachment.html>


More information about the graphics-rasterizer-dev mailing list