[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YK4BDmPDuXfxEDn7@smile.fi.intel.com>
Date: Wed, 26 May 2021 11:04:30 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Trent Piepho <tpiepho@...il.com>
Cc: linux-kernel@...r.kernel.org, andy@...nel.org,
akpm@...ux-foundation.org, oskar@...ra.com,
Daniel Latypov <dlatypov@...gle.com>,
Yiyuan Guo <yguoaz@...il.com>
Subject: Re: [PATCH v3 1/2] lib/math/rational.c: Fix divide by zero
On Tue, May 25, 2021 at 04:35:18PM -0700, Trent Piepho wrote:
> If the input is out of the range of the allowed values, either larger
> than the largest value or closer to zero than the smallest non-zero
> allowed value, then a division by zero would occur.
>
> In the case of input too large, the division by zero will occur on the
> first iteration. The best result (largest allowed value) will be found
> by always choosing the semi-convergent and excluding the denominator
> based limit when finding it.
>
> In the case of the input too small, the division by zero will occur on
> the second iteration. The numerator based semi-convergent should not be
> calculated to avoid the division by zero. But the semi-convergent vs
> previous convergent test is still needed, which effectively chooses
> between 0 (the previous convergent) vs the smallest allowed fraction
> (best semi-convergent) as the result.
What has been changed that you haven't applied my Rb tag?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists