Re: [PATCH v2 2/6] units: Add 32- and 64-bit signed values of π

From: David Lechner

Date: Fri Nov 07 2025 - 16:14:08 EST


On 11/7/25 3:09 PM, David Lechner wrote:
> 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.
>>
>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>> ---
>> include/linux/units.h | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/include/linux/units.h b/include/linux/units.h
>> index f626e212d4ca..5b3293bce04c 100644
>> --- a/include/linux/units.h
>> +++ b/include/linux/units.h
>> @@ -21,6 +21,12 @@
>> #define PICO 1000000000000ULL
>> #define FEMTO 1000000000000000ULL
>>
>> +/* 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

Typo. Should be DIV_ROUND_UP(PI, 10000) or DIV_ROUND_UP(PI, 10 * KILO).

> integer, of course).
>
> Calling these PI_E8 and PI_E18 or PI_x10_8 and PI_x10_18
> would help to clear that up.
>
>> +
>> +/* Value of π * 10¹⁸ (fits s64 or signed long long) */
>> +#define PI_LL 3141592653589793238LL
>> +
>> /* Hz based multipliers */
>> #define NANOHZ_PER_HZ 1000000000UL
>> #define MICROHZ_PER_HZ 1000000UL
>