All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Williams <patrick@stwcx.xyz>
To: Ed Tanous <edtanous@google.com>
Cc: OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Matt Spinler <mspinler@linux.ibm.com>,
	Vijay Khemka <vijaykhemkalinux@gmail.com>
Subject: Re: hardcoded median function in phosphor-virtual-sensor
Date: Tue, 5 Jan 2021 14:23:33 -0600	[thread overview]
Message-ID: <X/TKxS8ximiwRxLw@heinlein> (raw)
In-Reply-To: <CAH2-KxDECT96ZHfKadwLYUkbx2_MAqUBugteud-27XZVYELWPA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

On Tue, Jan 05, 2021 at 09:38:12AM -0800, Ed Tanous wrote:
> On Tue, Jan 5, 2021 at 7:59 AM Matt Spinler <mspinler@linux.ibm.com> wrote:
> >
> > Also, we need a slightly tweaked median of our 3 ambient temp sensors:
> > 1) throw out values outside of minInput/maxInput
> > 2) if there is an even number, because we threw out one, choose the
> > higher value, and
> >      don't do the average of the 2  that I believe an actual median
> > would use.
> > 3) if we threw out all 3 (very unlikely), use NaN as the sensor value.
> >
> 
> These kinds of corner cases are exactly why IMO C++ is easier in the
> long run.  Those 3 conditions are trivial to add to a C++ based
> daemon, but would require a lot of complex expertk code to define if
> the corner cases were found later.  In C++ they just end up as an
> extra branch.

I would agree.  If these are the kinds of problems that we end up
solving with PVS, exprtk is not appropriate.  The initial problem
attempting to be solved was "I have a small set of sensors that I need
to do some relatively simple math on".  The moment your "virtual sensor"
has an if-condition, exprtk is probably not the right screwdriver to
hammer with.

-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-01-05 20:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-04 17:48 hardcoded median function in phosphor-virtual-sensor Matt Spinler
2021-01-04 20:54 ` Vijay Khemka
2021-01-04 22:57   ` Matt Spinler
2021-01-05  2:34     ` Lei Yu
2021-01-05 14:18       ` Matt Spinler
2021-01-05 14:27     ` Patrick Williams
2021-01-05 15:56       ` Matt Spinler
2021-01-05 17:18         ` Vijay Khemka
2021-01-05 17:28           ` Matt Spinler
2021-01-05 17:38         ` Ed Tanous
2021-01-05 20:23           ` Patrick Williams [this message]
2021-01-05 20:20         ` Patrick Williams
2021-01-05 17:31   ` Ed Tanous
2021-01-05 17:30 ` Ed Tanous

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X/TKxS8ximiwRxLw@heinlein \
    --to=patrick@stwcx.xyz \
    --cc=edtanous@google.com \
    --cc=mspinler@linux.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=vijaykhemkalinux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.