[Python-ideas] Consider adding clip or clamp function to math
David Mertz
mertz at gnosis.cx
Fri Aug 5 07:29:46 EDT 2016
On Aug 5, 2016 2:13 AM, "Steven D'Aprano" <steve at pearwood.info> wrote:
> > x = [clamp(x[t], f(t), g(t)) for t in range(1_000_000)]
> >
> > is perfectly plausible code.
>
> I have my doubts. Sure, you can write it, but what would you use it for?
> What's your use-case?
Looks like ordinary trend with error bounds to me. I can easily imagine
writing that code is clamp is introduced.
And glad to see that Kahan explicitly supports my intuition on NaN not
genetically infecting every operation... In fact that clamp(x, nan, nan) is
explicitness x according to IEEE-754 2008... Not NaN.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160805/2457ff3c/attachment.html>
More information about the Python-ideas
mailing list