From e5480018437a0ff728cb248c1b94320fab8e74b8 Mon Sep 17 00:00:00 2001
From: Ramakrishnan Muthukrishnan <ram@rkrishnan.org>
Date: Fri, 14 Jan 2022 14:36:29 +0530
Subject: [PATCH] more experiments with rounding

---
 rigctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rigctl.c b/rigctl.c
index f8297fe..21a3fb5 100644
--- a/rigctl.c
+++ b/rigctl.c
@@ -3463,7 +3463,7 @@ int parse_cmd(void *data) {
       if (command[2] == ';') {
         int att = 0;
         if (have_rx_gain) {
-          att = (int)(adc[active_receiver->adc].attenuation + 12);
+          att = (int)round(adc[active_receiver->adc].attenuation + 12);
           att = (int)round((att * 99.0) / 60.0);
         } else {
           att = (int)(adc[active_receiver->adc].attenuation);
@@ -3475,7 +3475,7 @@ int parse_cmd(void *data) {
           command[4] = '\0';
           int att = strtol(&command[2], NULL, 10);
           if (have_rx_gain) {
-              att = (int)round(((att * 60.0) / 99.0)) - 12;
+              att = (int)round(((att * 60.0) / 99.0) - 12.0);
           } else {
               att = (int)round((att * 31.0) / 99.0);
           }
-- 
2.45.2