aboutsummaryrefslogtreecommitdiffstats
path: root/utils/rds-ctl/rds-ctl.cpp
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-04-17 14:33:32 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-20 14:40:14 +0200
commit1c07f54e233364b91729c02a3d56ee828ecd6b71 (patch)
tree6268b7b92260b1351f078a0ee43080229d613b1c /utils/rds-ctl/rds-ctl.cpp
parent1425381bd70753c6a5a279c0816ef54d50eb2147 (diff)
treewide: fix math problems
Found with bugprone-incorrect-roundings Found with performance-type-promotion-in-math-fn Signed-off-by: Rosen Penev <rosenp@gmail.com> [hverkuil-cisco@xs4all.nl: 655.25 -> 655.35] [hverkuil-cisco@xs4all.nl: add std:: to lround call] Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/rds-ctl/rds-ctl.cpp')
-rw-r--r--utils/rds-ctl/rds-ctl.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 93e314c2..770497d4 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -28,6 +28,7 @@
#include <libv4l2rds.h>
#include <cctype>
+#include <cmath>
#include <ctime>
#include <list>
#include <vector>
@@ -916,8 +917,8 @@ static void get_options(const int fd, const int capabilities, struct v4l2_freque
else
printf("\tFrequency range : %.1f MHz - %.1f MHz\n",
vt.rangelow / 16.0, vt.rangehigh / 16.0);
- printf("\tSignal strength/AFC : %d%%/%d\n",
- (int)((vt.signal / 655.35)+0.5), vt.afc);
+ printf("\tSignal strength/AFC : %ld%%/%d\n",
+ std::lround(vt.signal / 655.35), vt.afc);
printf("\tCurrent audio mode : %s\n", audmode2s(vt.audmode));
printf("\tAvailable subchannels: %s\n",
rxsubchans2s(vt.rxsubchans).c_str());

Privacy Policy