aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-14 16:11:02 +0100
committerDavid Robillard <d@drobilla.net>2020-12-14 16:11:02 +0100
commit778ff7201a2e3fcc9409f91ee83f2e8a962debf9 (patch)
tree26905f47d1d2c71db810513a7035286566d7ff8c
parent729fe9275b4c35372007d2e1af9a86d9c9589eab (diff)
downloadjalv-778ff7201a2e3fcc9409f91ee83f2e8a962debf9.tar.gz
jalv-778ff7201a2e3fcc9409f91ee83f2e8a962debf9.tar.bz2
jalv-778ff7201a2e3fcc9409f91ee83f2e8a962debf9.zip
Use the appropriate math functions for the operand precision
-rw-r--r--.clang-tidy1
-rw-r--r--src/jalv_gtk.c6
-rw-r--r--src/jalv_qt.cpp4
3 files changed, 5 insertions, 6 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 952940c..6cbee5d 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -40,7 +40,6 @@ Checks: >
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-modernize-use-using,
- -performance-type-promotion-in-math-fn,
-readability-implicit-bool-conversion,
-readability-inconsistent-declaration-parameter-name,
-readability-isolate-declaration,
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index a3d2e74..0f2a028 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -519,10 +519,10 @@ static void
set_float_control(const ControlID* control, float value)
{
if (control->value_type == control->jalv->forge.Int) {
- const int32_t ival = lrint(value);
+ const int32_t ival = lrintf(value);
set_control(control, sizeof(ival), control->jalv->forge.Int, &ival);
} else if (control->value_type == control->jalv->forge.Long) {
- const int64_t lval = lrint(value);
+ const int64_t lval = lrintf(value);
set_control(control, sizeof(lval), control->jalv->forge.Long, &lval);
} else if (control->value_type == control->jalv->forge.Float) {
set_control(control, sizeof(value), control->jalv->forge.Float, &value);
@@ -856,7 +856,7 @@ make_combo(ControlID* record, float value)
0, point->value,
1, point->label,
-1);
- if (fabs(value - point->value) < FLT_EPSILON) {
+ if (fabsf(value - point->value) < FLT_EPSILON) {
active = i;
}
}
diff --git a/src/jalv_qt.cpp b/src/jalv_qt.cpp
index c05391c..b3b5a38 100644
--- a/src/jalv_qt.cpp
+++ b/src/jalv_qt.cpp
@@ -522,7 +522,7 @@ Control::setValue(float value)
step = (std::find(scalePoints.begin(), scalePoints.end(), value)
- scalePoints.begin());
} else if (isLogarithmic) {
- step = steps * log(value / min) / log(max / min);
+ step = steps * logf(value / min) / logf(max / min);
} else {
step = value * steps;
}
@@ -575,7 +575,7 @@ Control::getValue()
} else if (isInteger) {
return dial->value();
} else if (isLogarithmic) {
- return min * pow(max / min, (float)dial->value() / (steps - 1));
+ return min * powf(max / min, (float)dial->value() / (steps - 1));
} else {
return (float)dial->value() / steps;
}