Skip to content

Commit

Permalink
Add parentheses to make the operator precedence explicit.
Browse files Browse the repository at this point in the history
  • Loading branch information
przemek83 committed Jan 9, 2025
1 parent f419c4c commit 0bbcae2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/QwtBleUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ bool doublesAreEqual(double left, double right)
{
static const double qtDoublePrecision{1e-12};
return std::abs(left - right) <=
qtDoublePrecision * std::max({1.0, std::abs(left), std::abs(right)});
(qtDoublePrecision *
std::max({1.0, std::abs(left), std::abs(right)}));
}

bool floatsAreEqual(float left, float right)
{
static const float qtFloatPrecision{1e-6F};
return std::abs(left - right) <=
qtFloatPrecision * std::max({1.0F, std::abs(left), std::abs(right)});
(qtFloatPrecision *
std::max({1.0F, std::abs(left), std::abs(right)}));
}

QString doubleToStringUsingLocale(double value, int precision)
{
static bool initialized{false};
static QLocale locale = QLocale::system();
static QLocale locale{QLocale::system()};
if (!initialized)
{
locale.setNumberOptions(locale.numberOptions() &
Expand Down

0 comments on commit 0bbcae2

Please sign in to comment.