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

Incomplete fraction reduction in getValueAsString() for TIFFTag.TIFF_RATIONAL, TIFFTag.TIFF_SRATIONAL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: client-libs
    • Labels:

      Description

      Please use the following code:

        long r[][] = {{-1, -1}};
        int type = TIFFTag.TIFF_RATIONAL;
        TIFFField f = new TIFFField(new TIFFTag("tag", 666, 1 << type), type, r.length, r);
        System.out.println(f.getValueAsString(0));


      Output:
        r[][] = {{-1, -1}}; -> "1/1"
        r[][] = {{-3, -3}}; -> "1/1"
        r[][] = {{0, -3}}; -> "0/1"
        r[][] = {{-4, 2}}; -> "-2/1"
        r[][] = {{-4, -2}}; -> "2/1"

      but, at the same time:
        long r[][] = {{-2, -3}}; -> "-2/-3" (expected: "2/3")
      and
        long r[][] = {{2, -4}}; -> "2/-4" (expected: at least, "-2/4", but much better: "1/2")

      So some rudiments of reducing fractions are implemented in getValueAsString(), but it would be nice to complete them (at least in part of the signs) or remove them completely to avoid the mess.

      The same for TIFFTag.TIFF_SRATIONAL

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bpb Brian Burkhalter
              Reporter:
              avstepan Alexander Stepanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: