You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Factor calibration value into nominal crystal frequency */
/* Measured in parts-per-ten million */
ref_freq += (uint32_t)((double)(correction / 10000000.0) * (double)ref_freq)
Fixed-point is perhaps more precise, using a "long long" aka int64_t:
/* Factor calibration value into nominal crystal frequency */
/* Measured in parts-per-ten million */
ref_freq += (int32_t) ((((((int64_t)correction) << 31) /
10000000LL) * ref_freq) >> 31);
Resulting linked binaries aren't that different in size (depending on optimization level in use).
Your mileage may vary.
The text was updated successfully, but these errors were encountered:
From pll_calc():
Fixed-point is perhaps more precise, using a "long long" aka int64_t:
Resulting linked binaries aren't that different in size (depending on optimization level in use).
Your mileage may vary.
The text was updated successfully, but these errors were encountered: