Mail Index


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ApacheGallery] Problems with calculation of ShutterSpeedValue..



On Fri, Jan 17, 2003 at 02:45:42PM +0100, Hans Joergensen wrote:
> On 17-Jan-2003, Thomas Eibner wrote:
> > > 2/3sec -> 5/10
> > > 1.0sec -> 0/10
> > > 1.5sec -> 4294967291/10
> > > 2.0sec -> 4294967286/10
> 
> Perhaps i should have said that these are from some testshots ;)
> 
> > Wevvy Wevvy helpfull. But the original picture was taken with a 4 second
> > shutter speed according to the exif info (and metacam). I can't see why
> > you are getting a division by zero 'cause at no point is the divisor
> > zero as far as I can see.  Which expression does perl tell you it fails
> > at?
> 
> First the error:
> [Thu Jan 16 14:50:08 2003] [error] Illegal division by zero at /usr/local/share/perl/5.6.1/Apache/Gallery.pm line 764.
>
> Since I use the foldercomment-patch I hacked, the linenumber don't match yours :)
> 
> if ($value < 1) {                       <----- Its this line.
>         $value = "1/" . (int((1/$value)));
> }

The previous expression:
$value = 1/(exp($value*log(2)));

Gets rounded of to zero when the value of $value is LARGE, so that is
the problem.
I wonder what that will do to our code, it looks like we can't calculate
the seconds value when the number is extremly large (like 4294967286/10)
I found the code to do the calculation in the php exif code, so I'll 
have to double check it. To me the values just look completly incorrect
(the ones taken from the picture).

-- 
  Thomas Eibner <http://thomas.eibner.dk/> DnsZone <http://dnszone.org/>
  mod_pointer <http://stderr.net/mod_pointer> <http://photos.eibner.dk/>
  !(C)<http://copywrong.dk/>                  <http://apachegallery.dk/>
          Putting the HEST in .COM <http://www.hestdesign.com/>