Re: [PATCH v1 2/6] units: Add value of π * 10⁹
From: Andy Shevchenko
Date: Tue Oct 28 2025 - 04:08:11 EST
On Mon, Oct 27, 2025 at 07:30:33PM +0000, David Laight wrote:
> On Mon, 27 Oct 2025 15:34:51 +0100
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> > There are a few drivers that want to have this value, and at least one
> > known to come soon. Let's define a value for them.
> > +/* Value of π * 10⁹ */
> > +#define PI 3141592653LL
>
> Is that the right value?
> IIRC the next digits are 58979 (I used to know the next few as well)
> which means it should be rounded up.
Right, today I have the same thought that actually ChromeOS driver has a
off-by-one issue there.
Btw, do you know if we can have compile-time divisions that can make 32-bit
constants out of the 64-bit input? DIV_ROUND_CLOSEST_ULL() doesn't seem allow
that.
--
With Best Regards,
Andy Shevchenko