From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D46D6C2B9F7 for ; Wed, 26 May 2021 08:05:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A7935613B4 for ; Wed, 26 May 2021 08:05:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233070AbhEZIHW (ORCPT ); Wed, 26 May 2021 04:07:22 -0400 Received: from mga04.intel.com ([192.55.52.120]:55602 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232918AbhEZIHR (ORCPT ); Wed, 26 May 2021 04:07:17 -0400 IronPort-SDR: 1m3ymH8wRRpx/2QdtZqjK+Apxe9bZduCy1W+lx6hoPOaG1Tg8eAH90SN0cq0jZe87XWAB2eCyV LEAvV5udi3Aw== X-IronPort-AV: E=McAfee;i="6200,9189,9995"; a="200508127" X-IronPort-AV: E=Sophos;i="5.82,330,1613462400"; d="scan'208";a="200508127" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 01:04:35 -0700 IronPort-SDR: RCuBtDICtBHu9bpHTRoSxBjSVwL8/TUojpYy2FvmbgZwnvxHDDbjgGyb2500tnnTH+oiMLL7gW /bfKygtCcI6g== X-IronPort-AV: E=Sophos;i="5.82,330,1613462400"; d="scan'208";a="414370555" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 May 2021 01:04:33 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1lloWk-00Ekdp-AQ; Wed, 26 May 2021 11:04:30 +0300 Date: Wed, 26 May 2021 11:04:30 +0300 From: Andy Shevchenko To: Trent Piepho Cc: linux-kernel@vger.kernel.org, andy@kernel.org, akpm@linux-foundation.org, oskar@scara.com, Daniel Latypov , Yiyuan Guo Subject: Re: [PATCH v3 1/2] lib/math/rational.c: Fix divide by zero Message-ID: References: <20210525233519.343068-1-tpiepho@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210525233519.343068-1-tpiepho@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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