Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1218662pxb; Tue, 1 Feb 2022 22:53:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQPRipXOW0wk3kZae78589f063W9hKaS6ic/cIH20utvdt6m1o6ymIWiPXco2FaSsqJ+N5 X-Received: by 2002:a05:6a00:1345:: with SMTP id k5mr28683023pfu.29.1643784807769; Tue, 01 Feb 2022 22:53:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643784807; cv=none; d=google.com; s=arc-20160816; b=RG5rhsGGKza0SEjD5P73TToaCHiBDT3lMaAq1r4JcQ+2m2NKj7gAvaNYx3pvvGHrHM mcj7fRNlX0xICslO6fduPahf3j7m9TMPGcoH79GYcz6P+sbB1FPX7pXR8zn7Yl7SdaeF b46hsp3P/d2y3/fc99wGtsBzqrpzoeiHgwHj+zIv0sPuUG25EB/kzTi5ejeCV7V4jY6A 7lzQ4KpyN6pbzbFXEq4SVv7EkdXCzSk9b+gfaEh0HKXjy+SXy18ZWcLQNFErd0tHpMbl S6UMziCSCbD9TSvHBe59JE1FBBvb0xt/eY7a7DWJZLHkRbwScYfWkwB3gzwje5OEIPux GO1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zc0YUBbP4nO5xY/HXkwm2TEbGRUwzysYtK0Wp/4IoWE=; b=UHlaR5K9prO6IkC6bFBMEgwtC7fN7SZWiXcJxKl87SRM2JfycjY61g0DVCIBiwzrvH Z13eq6MtkPvMNN+hcm4evQtYBbirrrdqFX2hajLab57JY0I/hb/ElTrDyTK7wAGZdnU/ Oswb+PAso955mdUX8UOBm4v/yAHY5WscuH2fLLb38DB6Rsi2lLb0iOx+PuvkaLIWE4LL 1zgoLuPLYZ60o1m9I7FYzhMOutdyX62pJApuET6pzwyWyRhL9BNiPF7o5hi2I7PhliAq 9M09RlVUzCfFPjjtMxu/3WxJoD+1yWMkJ3zIEV6G2mmUqd+UKAwhFz6JJKQOTNbKBVfN xPYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="e7qSjd/0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi15si5107924pjb.156.2022.02.01.22.53.16; Tue, 01 Feb 2022 22:53:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="e7qSjd/0"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235921AbiBAJWN (ORCPT + 99 others); Tue, 1 Feb 2022 04:22:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235902AbiBAJWN (ORCPT ); Tue, 1 Feb 2022 04:22:13 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A74EC061714; Tue, 1 Feb 2022 01:22:12 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id jx6so52502706ejb.0; Tue, 01 Feb 2022 01:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zc0YUBbP4nO5xY/HXkwm2TEbGRUwzysYtK0Wp/4IoWE=; b=e7qSjd/0adrVrIIWN9p3EskCqHxGkJbwEIdTPOfRwrTlIc7VjHD1tc9nhYQNhbjaDL 734EopB6UFXritQodtoOvtiP6KNtM0qHwnYOzQuFnhJlYtpmRXBzPMXC2mKN3wA5luj2 VEPM1v47mucgLRp258bkjvaWtGo7eji9twznQncL5at5xnEUJ981gPsI0IZkVXHTaFxx LmAcAYA08Srh4owUN1WUl6LkVUNliUHlPzaZlmZFUGOUqpdmM5JsHCcCo1j/LsJIW7cO 27syUfF3hjPpaIfvdWsScGdJ6Albm57lUtRA9DZhjjI4KbWdeWfVCFMCpsb9YQg69wbP fdSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zc0YUBbP4nO5xY/HXkwm2TEbGRUwzysYtK0Wp/4IoWE=; b=6XbEyRJAGB1xhFbCoHdj2Vzv7OAc71vPN9jbmZwXpQNc0Ktcv4fxDlrxRjgTErXVJs zE1scN/3dAWwogcyoP9CKQsWPzm1NUUCFaYAIdYLqfPD4ODe+TfUCfuPri2BNACFFGCY zznY+V5sF0/B3vWNhcEKZHMsOWUsxzhOaT0ZgwvSNmG5Lb6A0QEbBNmkoI0lFEWUm7H3 GU7U40Ym06JkmTexvBoVIJeSA00YjP/aFj4wEdwnmse88OcSjxlK7TdueV27TCrJ0sfy Bvwaj06dj7zdFBUnrxMywntDw4s0OsFYlGzIzmXdcbigNMey7KWFzpNAI5GmgRRSq3Sr 99YQ== X-Gm-Message-State: AOAM530+SVO3PfaiQympfDoZQokB40vG2ctNMidKJYtkzFPK5n2TGMnk RW3EyUnE+4Ky5YdTB+ToK91yp0QpQeIhsP1BK1i7QyhhKbY= X-Received: by 2002:a17:907:a40a:: with SMTP id sg10mr20861269ejc.44.1643707331063; Tue, 01 Feb 2022 01:22:11 -0800 (PST) MIME-Version: 1.0 References: <20220130161101.1067691-1-liambeguin@gmail.com> <20220130161101.1067691-7-liambeguin@gmail.com> <5da96dc7-696b-1bc0-a111-f6108ecfa54c@axentia.se> In-Reply-To: From: Andy Shevchenko Date: Tue, 1 Feb 2022 11:20:35 +0200 Message-ID: Subject: Re: [PATCH v13 06/11] iio: afe: rescale: make use of units.h To: Peter Rosin Cc: Liam Beguin , Jonathan Cameron , Lars-Peter Clausen , Linux Kernel Mailing List , linux-iio , devicetree , Rob Herring Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 1, 2022 at 3:59 AM Peter Rosin wrote: > On 2022-01-31 16:23, Andy Shevchenko wrote: > > On Mon, Jan 31, 2022 at 4:50 PM Peter Rosin wrote: > >> On 2022-01-30 17:10, Liam Beguin wrote: > > > > ... > > > >>> - tmp = div_s64_rem(tmp, 1000000000LL, &rem); > >>> + tmp = div_s64_rem(tmp, GIGA, &rem); > >> > >> It is NOT easy for me to say which of GIGA/NANO is most fitting. > > > > What do you mean? The idea behind is the use of the macro depending on > > the actual power of 10 in use (taking into account the sign of the > > exponent part). > > > >> There are a couple of considerations: > >> > >> A) 1000000000 is just a big value (GIGA fits). Something big is > >> needed to not lose too much precision. > > > > Does it have a physical meaning? > > No, this is just a scaling factor which is moments later > eliminted by a matching inverse operation. It's math purely > about attempting to preserve precision and has nothing to do > with the units of the values that are involved. I see your point now, shame on me. -- With Best Regards, Andy Shevchenko