clamping the return value of uniform.cdf() to [0..1] (#7538)

* fix for #7532: clamping the return value of uniform.cdf() to the range [0,1]

* removed whitespace around equals to pass flake8 tests

* added a test for uniform.cdf() with arguments outside support
This commit is contained in:
andreh7
2018-05-14 21:36:00 +02:00
committed by Edward Z. Yang
parent bccb727b65
commit 61afbbbd18
2 changed files with 5 additions and 1 deletions

View File

@ -71,7 +71,7 @@ class Uniform(Distribution):
if self._validate_args:
self._validate_sample(value)
result = (value - self.low) / (self.high - self.low)
return result
return result.clamp(min=0, max=1)
def icdf(self, value):
if self._validate_args: