[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vde6K-EAEwN_0zTO+9e-KCq-V3t84BXu0Tm-P04f1endA@mail.gmail.com>
Date: Sat, 27 Dec 2025 18:48:21 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Jonathan Santos <Jonathan.Santos@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, lars@...afoo.de,
Michael.Hennerich@...log.com, dlechner@...libre.com, nuno.sa@...log.com,
andy@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
jonath4nns@...il.com
Subject: Re: [PATCH v5 3/5] units: add PERCENT and BASIS_POINTS macros
On Sat, Dec 27, 2025 at 5:55 PM Jonathan Cameron <jic23@...nel.org> wrote:
> On Wed, 17 Dec 2025 02:52:45 -0300
> Jonathan Santos <Jonathan.Santos@...log.com> 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
Powered by blists - more mailing lists