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

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • tbd
    • Affects Version/s: 9
    • Component/s: client-libs

      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

            Assignee:
            Brian Burkhalter
            Reporter:
            Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: