lkml.org 
[lkml]   [2022]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH v15 05/10] clk: Add Sunplus SP7021 clock driver
Date
> > > > +
> > > > + df_quotient = df / m;
> > > > + df_remainder = ((df % m) * 1000) / m;
> > > > +
> > > > + if (freq > df_quotient) {
> > > > + df_quotient = freq - df_quotient - 1;
> > > > + df_remainder = 1000 - df_remainder;
> > >
> > > Where does 1000 come from?
> >
> > 1000 is come from "borrow 1" in last operation.
>
> It's scaling the value right? What is being scaled? Are we converting
> units to Hz from kHz?

Here just using integer replacement floating point operation, for example:
df = 13, m = 3
13 / 3 = 4.33333333
df_quotient = 4
df_remainder = 0.3333333 * 1000 (accurate to 3 decimal places) = 333

\
 
 \ /
  Last update: 2022-05-19 04:30    [W:0.065 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site