lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aRDKwFkjOSfypJVW@smile.fi.intel.com>
Date: Sun, 9 Nov 2025 19:09:20 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>,
	David Lechner <dlechner@...libre.com>,
	Hans Verkuil <hverkuil+cisco@...nel.org>,
	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
	"chrome-platform@...ts.linux.dev" <chrome-platform@...ts.linux.dev>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
	Nuno Sá <nuno.sa@...log.com>,
	Andy Shevchenko <andy@...nel.org>,
	Benson Leung <bleung@...omium.org>,
	Guenter Roeck <groeck@...omium.org>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Michael Hennerich <Michael.Hennerich@...log.com>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	"Daniel W. S. Almeida" <dwlsalmeida@...il.com>
Subject: Re: [PATCH v2 2/6] units: Add 32- and 64-bit signed values of π

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@...il.com> wrote:
> > пʼятниця, 7 листопада 2025 р. David Lechner <dlechner@...libre.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



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ