1999.06.17 00:07 "Controlling Rational Values", by Tom Denny

1999.06.21 07:48 "Re: Controlling Rational Values", by Bjorn Brox

Why make it so complex?

The solution is as simple as the nature of the general problem I had to solve, and no simpler.

However, if absolute size of a scanned target is important, and the original scanning resolution was 200:1, and if in an image processing program the original data was downsized by a factor of three, then the resulting TIFF image tags should be updated to read 200 / 3.


etc. etc.

Whatever solution you choose: When the number is 200.0, 150.0 etc, i.e. a number without any decimals my code suggestion/trick would give a better precision that yours, by storing these numbers as n/1:

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

Trust me: it's simple and it works, and the "else" part is the original code that might need some more tuning.

BTW: Have we got anyone to take over Sam's work on keeping the source control over libtiff?

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