on my system
# radioctl frequency=99.3
frequency: 99.25MHz -> 99.25MHz

Not a big deal, but frequencies of 99.3 being interpreted as slightly lower
at 99.25
is not ideal for some applications
This happens for other floats ending in '.3', '.1', etc

I tracked this down in radioctl.c to the function str_to_int():
if (optval == OPTION_FREQUENCY)
val = (int)(1000 * atof(str))
with the str="99.3", the integer val generated is 99299
because of integer truncation with the cast

a version that generates more expected values for me is something like:
val = lrint(1000*strtod(str, NULL));

at the cost of lrint() requiring the <math.h> header, and math library
and strtod() instead of the (deprecated) atof()

just FYI if someone wanted to update it

Reply via email to