AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1999.06.17 00:07 "Controlling Rational Values", by Tom Denny
1999.06.20 21:19 "Re: Controlling Rational Values", by Niles Ritter
1999.06.21 05:53 "Re: Controlling Rational Values", by Bjorn Brox
1999.06.21 07:12 "Re: Controlling Rational Values", by Niles Ritter
1999.06.21 07:48 "Re: Controlling Rational Values", by Bjorn Brox

1999.06.21 05:53 "Re: Controlling Rational Values", by Bjorn Brox

Niles Ritter wrote this:
>

Explicitly setting the denominator to some value sounds like a bad idea;

what yo u really want is the "best" representation, which for anything

sufficiently close to an integer gives (x,1).

> To do this you create what's called a continued-fraction expansion

...
> for such rubbish. There is a reason the tag was called rational, after all...
>
Why make it so complex?

I have never seen x/y resolution defined with decimals.

Therefore: storing 200.0 as something else than 200/1 seems stupid, and makes it more difficult to "debug" tiff files.

I would add this simple test to TIFFWriteRationalArray()

    if (fv == (float)((int)fv)) {
        t[2*i+0] = (int)fv;
        t[2*i+1] = 1L;
    } else {
        ...
    }

and ask Niles Ritter to improve the complex method of writing a rational.

--
Bjorn Brox, CORENA Norge AS, http://www.corena.no/
Kirkegaardsvn. 45, P.O.Box 1024, N-3601 Kongsberg, NORWAY
Phone: +47 32737435, Fax: +47 32736877, Mobile: +47 92638590