Re: [PATCH v5 3/5] units: add PERCENT and BASIS_POINTS macros
From: Andy Shevchenko
Date: Sat Dec 27 2025 - 11:49:07 EST
On Sat, Dec 27, 2025 at 5:55 PM Jonathan Cameron <jic23@xxxxxxxxxx> wrote:
> On Wed, 17 Dec 2025 02:52:45 -0300
> Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> wrote:
...
> > +/*
> > + * Percentage and basis point units
> > + *
> > + * Basis points are 1/100th of a percent (1/100), commonly used in finance,
> > + * engineering or other applications that require precise percentage
> > + * calculations.
> > + *
> > + * Examples:
> > + * 100% = 10000 basis points = BASIS_POINTS
> > + * 1% = 100 basis points = PERCENT
>
> I don't understand the final equality in these examples.
> The top line is as it says 10000 basis points but you have it equal
> to BASIS_POINTS?
>
> > + */
> > +#define PERCENT 100UL
Be careful with UL. What would be 10% from -555 (minus five hundreds
fifty five)?
--
With Best Regards,
Andy Shevchenko