Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4668379

Hotspot produces incorrect numerical results on Solaris/SPARC for customer app

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0_02
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      02
    • CPU:
      sparc
    • OS:
      solaris_9

      Backports

        Description


        This application produces different results when run using Hotspot on Solaris
        when compared to interpreted on Solaris and Hotspot on Windows.

        Both the interpreted on Solaris and Hotspot on Windows produce the same
        result.

        Here is the erroneous output when running Solaris hotspot

        kaap 0.233333 -0.19450298 -0.84714305 -0.49448702 0.21062
        test -0.020445267 -0.08904782 -0.051978223 0.99446005
        q1 (1.44787427E12, 6.3061072E12, 3.68094662E12, 0.99446005)

        And here is the correct result from Interpreted Solaris and Win32 runs

        kaap 0.233333 -0.19450298 -0.84714305 -0.49448702 0.21062
        test -0.020445267 -0.08904782 -0.051978223 0.99446005
        q1 (-0.020445267, -0.08904782, -0.051978223, 0.99446005)

        Note the difference in q1

        test and q1 are calculated using the data in kaap, using the same algorithm.
        As an aid to tracking down this issue I copied the source the method in
        Quat4f (which set's the values in q1) and created a test method which prints
        the results. You'll notice they have different results.

        Here is the code that printed test

            private void quatTest( AxisAngle4f a ) {
                float mag,amag;
                double EPS = 0.000001;
                float w, x, y, z;
                /* Quat = cos(theta/2) + sin(theta/2)(roation_axis) */
                amag = (float)Math.sqrt( a.x*a.x + a.y*a.y + a.z*a.z);
                if (amag < EPS ) {
                    w = 0.0f;
                    x = 0.0f;
                    y = 0.0f;
                    z = 0.0f;
                } else {
                    amag = 1.0f/amag;
                    mag = (float)Math.sin(a.angle/2.0);
                    w = (float)Math.cos(a.angle/2.0);
                    x = a.x*amag*mag;
                    y = a.y*amag*mag;
                    z = a.z*amag*mag;
                }
                
                System.out.println( "test "+x+" "+y+" "+z+" "+w);
            }

        Apart from the local declaration of w,x,y,z and the println the same source
        is used in Quat4f.set( AxisAngle4f ) method. If you need the source for
        Quat4f I can provide it.

        The example requires Java3D to be installed, which is available from
        hoth.sfbay/downloads.

        To run the app untar the attachment nwn.tar.gz, cd to nwn and execute

        java ObjLoad data/Flesh_Golem.mdl flesh_golem:ca1slashr

        The app opens a window which is empty, it will then print a message
        "ModelAnimation Error....", wait until it prints this message twice and
        then exit the app. The message has no bearing on this bug.

        I've also attached the output from my test runs. animout.txt.hotspot is the
        hotspot run and animout.txt.interp is with -Xint, both on Solaris.

        Running filemerge on these two files will highlight the errors.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kbr Kenneth Russell (Inactive)
                Reporter:
                duke J. Duke (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: