We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 61a22d4 commit 8be3633Copy full SHA for 8be3633
hypothesis-python/src/hypothesis/internal/floats.py
@@ -208,11 +208,11 @@ def sign_aware_lte(x: float, y: float) -> bool:
208
209
def clamp(lower: float, value: float, upper: float) -> float:
210
"""Given a value and lower/upper bounds, 'clamp' the value so that
211
- it satisfies lower <= value <= upper."""
+ it satisfies lower <= value <= upper. NaN is mapped to lower."""
212
# this seems pointless (and is for integers), but handles the -0.0/0.0 case.
213
- if sign_aware_lte(value, lower):
+ if not sign_aware_lte(lower, value):
214
return lower
215
- if sign_aware_lte(upper, value):
+ if not sign_aware_lte(value, upper):
216
return upper
217
return value
218
0 commit comments