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

Floating point differences in math.c on Alpha platform

XMLWordPrintable

    • generic
    • generic

      For the JDK 116 release on the DIGITAL UNIX platform running on DIGITAL's
      Alpha hardware, DIGITAL has changed, for the reasons listed below, the
      following JDK 116 source files in the shared part of the JDK.

      Compatibility of the changes with Sun's JDK was assured by visual inspection of
      the changes and by running the appropriate JCK test suites. No changes were
      made to modify any APIs nor to modify the virtual machine instruction set.

      - The following files were modified because of differences in the Alpha
      hardware on which DIGITAL UNIX runs:

          - Floating point differences
              src/share/java/lang/math.c


      Diffs:
      ======
      diff -r digital_src/src/share/java/lang/math.c javasoft_src/src/share/java/lang/math.c
      1d0
      < /* Modifications Copyright 1997 Digital Equipment Corporation */
      287d285
      < /*** cds - v was long ***/
      289c287
      < java_lang_Float_intBitsToFloat(Hjava_lang_Float *this, int v)
      ---
      > java_lang_Float_intBitsToFloat(Hjava_lang_Float *this, long v)
      300,301c298,299
      < /*** cds - was long ***/
      < int
      ---
      >
      > long
      398,401d395
      < /*** cds - special cases to pass jck:
      < *** ceil(-0.0) == -0.0
      < *** ceil(x) == -0.0 for -1.0 < x < 0.0
      < ***/
      405,414c399
      < double ret;
      < if (IS_NEG0(f)) {
      < return f;
      < } else {
      < if (finite(f) && (-1.0 < f) && (f < 0.0)) {
      < return -0.0;
      < } else {
      < return ceil(f);
      < }
      < }
      ---
      > return ceil(f);
      417d401
      < /*** cds - special case for floor(-0.0) == -0.0 to pass jck ***/
      421,424c405
      < if (IS_NEG0(f))
      < return f;
      < else
      < return floor(f);
      ---
      > return floor(f);
      430,433c411
      < if (!IS_NEG0(f)) /*** HDS add special case for -0.0 ***/
      < return rint(f);
      < else
      < return -0.0;
      ---
      > return rint(f);
      436d413
      < /*** cds - handle atan2( +/-inf, +/-inf) as a special case to pass jck ***/
      440,444c417
      < if (IS_INF(f1) && IS_INF(f2)) {
      < return atan2( copysign (1.0, f1), copysign (1.0, f2));
      < } else {
      < return atan2(f1,f2);
      < }
      ---
      > return atan2(f1,f2);
      453,454d425
      < /*** cds - handle f2 = +/-0.0 as special case, return -0.0 when required ***/
      < /*** these changes are parallel to the changes for drem in executeJava.c ***/
      458d428
      < /*** Sun code was merely:
      460,476d429
      < ***/
      <
      < double ret;
      <
      < if (!finite(f1) || (f2 == 0.0)) {
      < ret = DBL_QNAN;
      < } else {
      < ret = IEEEREM (f1, f2);
      < /* printf ("IEEEremainder: IEEEremainder (%g, %g) = %g\n", f1, f2, ret); */
      < if (ret == 0.0) {
      < /* make sure the sign is correct for a 0.0 result */
      < if ((f1 < 0.0) || IS_NEG0(f1))
      < ret = -0.0;
      < }
      < }
      <
      < return ret;

            hongzh Hong Zhang
            jbenoit Jonathan Benoit (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: