Bug 169814

Summary: compilation error: no exp2()
Product: [Applications] digikam Reporter: Thomas Klausner <tk>
Component: Portability-CompilationAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: andi.clemens, caulier.gilles, marcel.wiesweg
Priority: NOR    
Version: 0.10.0   
Target Milestone: ---   
Platform: NetBSD pkgsrc   
OS: NetBSD   
Latest Commit: Version Fixed In: 8.2.0
Sentry Crash Report:
Attachments: Proposed patch

Description Thomas Klausner 2008-08-25 21:22:46 UTC
Version:           0.10.0-beta2 (using KDE 4.1.0)
Compiler:          gcc (GCC) 4.1.3 20080202 prerelease (NetBSD nb1 20080202) 
OS:                NetBSD
Installed from:    NetBSD pkgsrc

digikam fails to compile on NetBSD-4.99.72/amd64, because there is no exp2() provided by the system libraries:

[  4%] Building CXX object digikam/CMakeFiles/digikam.dir/__/libs/dmetadata/dmet
adata.o
/scratch/digikam-kde4/work/digikam-0.10.0-beta2/libs/dmetadata/dmetadata.cpp
: In static member function 'static double Digikam::DMetadata::apexApertureToFNu
mber(double)':
/scratch/digikam-kde4/work/digikam-0.10.0-beta2/libs/dmetadata/dmetadata.cpp
:1211: error: 'exp2' was not declared in this scope
/scratch/digikam-kde4/work/digikam-0.10.0-beta2/libs/dmetadata/dmetadata.cpp
: In static member function 'static double Digikam::DMetadata::apexShutterSpeedT
oExposureTime(double)':
/scratch/digikam-kde4/work/digikam-0.10.0-beta2/libs/dmetadata/dmetadata.cpp
:1257: error: 'exp2' was not declared in this scope
*** Error code 1

Please use exp(log(2)*value) (or something similar) instead.
Comment 1 Thomas Klausner 2008-08-25 21:26:02 UTC
Created attachment 27044 [details]
Proposed patch
Comment 2 Andi Clemens 2008-08-25 23:14:16 UTC
SVN commit 852440 by aclemens:

compile

 M  +2 -2      dmetadata.cpp  


--- trunk/extragear/graphics/digikam/libs/dmetadata/dmetadata.cpp #852439:852440
@@ -1208,7 +1208,7 @@
         return 22;
     else if (aperture == 10.0)
         return 32;
-    return exp2(aperture / 2.0);
+    return exp(log(2) * aperture / 2.0);
 }
 
 double DMetadata::apexShutterSpeedToExposureTime(double shutterSpeed)
@@ -1254,7 +1254,7 @@
     else if (shutterSpeed == 13.0)
         return 0.000125; // 1/8000
 
-    return exp2( - shutterSpeed);
+    return exp( - log(2) * shutterSpeed);
 }
 
 /**
Comment 3 Andi Clemens 2008-08-25 23:14:49 UTC
Please test if everything is fine for you now.
Comment 4 Andi Clemens 2008-09-07 15:00:53 UTC
Everything alright with this commit? Can we close this?
Comment 5 caulier.gilles 2008-09-07 19:01:38 UTC
For me the patch is fine and can be applied.

Marcel, you have implemented this code originally. Fine for you ?

Gilles
Comment 6 Marcel Wiesweg 2008-09-08 04:19:26 UTC
Yes, fine for me.
Comment 7 Thomas Klausner 2008-09-08 09:53:05 UTC
Since my patch was committed, I'm happy. Thanks!