[Python-ideas] Consider adding clip or clamp function to math

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Aug 4 01:59:39 EDT 2016


Chris Barker - NOAA Federal wrote:
> One could argue that:
> 
> clamp(NaN, x,x)
> 
> Is clearly defined as x. But that would require special casing, and,
> "equality" is a bit of an ephemeral concept with floats, so better to
> return NaN.

Yeah, it would only apply to a vanishingly small part of
the possible parameter space, so I don't think it would
be worth the bother.

-- 
Greg


More information about the Python-ideas mailing list