Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pow #3070

Merged
merged 2 commits into from
Nov 18, 2024
Merged

use pow #3070

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/canonmn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,7 @@ std::ostream& CanonMakerNote::printLe0x0000(std::ostream& os, const Value& value
std::ostream& CanonMakerNote::printSi0x0001(std::ostream& os, const Value& value, const ExifData*) {
std::ios::fmtflags f(os.flags());
if (value.typeId() == unsignedShort && value.count() > 0) {
os << std::exp(canonEv(value.toInt64()) / 32 * std::log(2.0F)) * 100.0F;
os << std::pow(2.0F, canonEv(value.toInt64()) / 32) * 100.0F;
}
os.flags(f);
return os;
Expand All @@ -3063,7 +3063,7 @@ std::ostream& CanonMakerNote::printSi0x0002(std::ostream& os, const Value& value
std::ios::fmtflags f(os.flags());
if (value.typeId() == unsignedShort && value.count() > 0) {
// Ported from Exiftool by Will Stokes
os << std::exp(canonEv(value.toInt64()) * std::log(2.0F)) * 100.0F / 32.0F;
os << std::pow(2.0F, canonEv(value.toInt64())) * 100.0F / 32.0F;
}
os.flags(f);
return os;
Expand Down
2 changes: 1 addition & 1 deletion src/nikonmn_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ const TagInfo* Nikon3MakerNote::tagListLd4() {
}

std::ostream& Nikon3MakerNote::printIiIso(std::ostream& os, const Value& value, const ExifData*) {
auto v = std::lround(100.0 * std::exp((value.toInt64() / 12.0 - 5) * std::log(2.0)));
auto v = std::lround(100.0 * std::pow(2.0, value.toInt64() / 12.0 - 5));
return os << v;
}

Expand Down
4 changes: 2 additions & 2 deletions src/tags_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2593,7 +2593,7 @@ std::ostream& printBitmask(std::ostream& os, const Value& value, const ExifData*
}

float fnumber(float apertureValue) {
float result = std::exp(std::log(2.0F) * apertureValue / 2.F);
float result = std::pow(2.0F, apertureValue / 2.F);
if (std::abs(result - 3.5) < 0.1) {
result = 3.5;
}
Expand All @@ -2602,7 +2602,7 @@ float fnumber(float apertureValue) {

URational exposureTime(float shutterSpeedValue) {
URational ur(1, 1);
const double tmp = std::exp(std::log(2.0) * static_cast<double>(shutterSpeedValue));
const double tmp = std::pow(2.0, shutterSpeedValue);
if (tmp > 1) {
const double x = std::round(tmp);
// Check that x is within the range of a uint32_t before casting.
Expand Down
2 changes: 1 addition & 1 deletion src/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ std::istream& fromStreamToRational(std::istream& is, T& r) {
char F = 0;
float f = 0.F;
is >> F >> f;
f = 2.0F * std::log(f) / std::log(2.0F);
f = 2.0F * std::log2(f);
r = Exiv2::floatToRationalCast(f);
} else {
int32_t nominator = 0;
Expand Down
Loading