Post Go back to editing

Function ad9361_rx_adc_setup ADC coefficients calculation

Category: Software
Product Number: AD9361

Hello.

Help me place brackets correctly in the ADC coefficients calculation function.
file github.com/.../ad9361.c
function ad9361_rx_adc_setup

data[26] = min_t(uint32_t, 63U, 63 * scaled_adc_clk_1e6 / 1000000 *
(920 + 80 * inv_scaled_adc_clk_1e3 / 1000) / 1000 );

I will take my own numbers as an example
>scaled_adc_clk_1e6 42240, inv_scaled_adc_clk_1e3 23674

if I use a calculator to count 63 * 42240/1000000 * (920 + 80 * 23674/1000)/1000 = 7.488
rounded up we get 7.

If this is calculated in integer mode (as done by CPU) then we get 5.

How to calculate correctly? And how to put parentheses correctly?

Thanks in advance.