From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
"David Lechner" <dlechner@baylibre.com>,
"Hans Verkuil" <hverkuil+cisco@kernel.org>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"chrome-platform@lists.linux.dev"
<chrome-platform@lists.linux.dev>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Benson Leung" <bleung@chromium.org>,
"Guenter Roeck" <groeck@chromium.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Daniel W. S. Almeida" <dwlsalmeida@gmail.com>
Subject: Re: [PATCH v2 2/6] units: Add 32- and 64-bit signed values of π
Date: Sun, 9 Nov 2025 19:09:20 +0200 [thread overview]
Message-ID: <aRDKwFkjOSfypJVW@smile.fi.intel.com> (raw)
In-Reply-To: <20251109170032.2763ae5b@jic23-huawei>
On Sun, Nov 09, 2025 at 05:00:32PM +0000, Jonathan Cameron wrote:
> On Sat, 8 Nov 2025 21:02:54 +0200
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > пʼятниця, 7 листопада 2025 р. David Lechner <dlechner@baylibre.com> пише:
> > > On 11/7/25 2:03 PM, Andy Shevchenko wrote:
> > > > There are a few drivers that want to have these values, and
> > > > one more known to come soon. Let's define the values for them.
...
> > > > +/* Value of π * 10⁸ (fits s32 or signed int) */
> > > > +#define PI 314159265
> > >
> > > It isn't clear to me at all in the other patches that e.g.
> > > DIV_ROUND_UP(PI, 1000) would be π ✕ 10⁴ (rounded to nearest
> > > integer, of course).
> > >
> > > Calling these PI_E8 and PI_E18 or PI_x10_8 and PI_x10_18
> > > would help to clear that up.
> >
> > This will be an awful and ugly name(s). I fully disagree on such a
> > proposal. The power is chosen to fit the type with maximum precision, no
> > need to explain this in the name.
> With no indicate of the multiplier we have to check it every time wwe
> use it which isn't ideal either.
>
> So I agree with David that we have to indicate this somewhere. Maybe hold the
> multiplier in a separate define
> #define PI_MUL
> #define PI_MUL_LL
>
> Then compute the divisions by (PI_MUL) / KILO or something along those lines?
I see, we have a disagreement here, because I don't like to uglify the pure PI
definition. So, please abandon this series then.
> > > > +/* Value of π * 10¹⁸ (fits s64 or signed long long) */
> > > > +#define PI_LL 3141592653589793238LL
Note, this constant is used a lot in the tests (3+ modules), so if you go with
your version, take this into account.
> > > > /* Hz based multipliers */
> > > > #define NANOHZ_PER_HZ 1000000000UL
> > > > #define MICROHZ_PER_HZ 1000000UL
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-09 17:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-07 20:02 [PATCH v2 0/6] iio: Introduce and use value of π Andy Shevchenko
2025-11-07 20:02 ` [PATCH v2 1/6] media: vidtv: Rename PI definition to PI_SAMPLES Andy Shevchenko
2026-03-16 10:13 ` Hans Verkuil
2026-03-16 11:18 ` Andy Shevchenko
2025-11-07 20:03 ` [PATCH v2 2/6] units: Add 32- and 64-bit signed values of π Andy Shevchenko
2025-11-07 21:09 ` David Lechner
2025-11-07 21:14 ` David Lechner
[not found] ` <CAHp75VexvdYyjt1GkbfqOotkFpLeb=io6outJ5dpRqBv2qPNng@mail.gmail.com>
2025-11-09 17:00 ` Jonathan Cameron
2025-11-09 17:09 ` Andy Shevchenko [this message]
2025-11-07 20:03 ` [PATCH v2 3/6] media: dvb-frontends: atbm8830: Convert to use PI definition Andy Shevchenko
2025-11-07 20:03 ` [PATCH v2 4/6] iio: cros_ec_sensors: " Andy Shevchenko
2025-11-07 20:03 ` [PATCH v2 5/6] iio: frequency: ad9523: " Andy Shevchenko
2025-11-07 20:03 ` [PATCH v2 6/6] iio: position: iqs624-pos: " Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aRDKwFkjOSfypJVW@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--cc=bleung@chromium.org \
--cc=chrome-platform@lists.linux.dev \
--cc=dlechner@baylibre.com \
--cc=dwlsalmeida@gmail.com \
--cc=groeck@chromium.org \
--cc=hverkuil+cisco@kernel.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox