8000 address review · python/cpython@1a2d3e4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1a2d3e4

Browse files
committed
address review
1 parent 5e4db08 commit 1a2d3e4

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

Doc/library/math.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ Floating point manipulation functions
434434

435435
.. function:: signbit(x)
436436

437-
Return :const:`True` if *x* is negative and :const:`False` otherwise.
437+
Return ``True`` if the sign of *x* is negative and ``False`` otherwise.
438438

439439
This is useful to detect the sign bit of zeroes, infinities and NaNs.
440440

Lib/test/test_math.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@
1818
eps = 1E-05
1919
NAN = float('nan')
2020
NNAN = float('-nan')
21-
DNAN = decimal.Decimal("nan")
22-
DNNAN = decimal.Decimal("-nan")
2321
INF = float('inf')
2422
NINF = float('-inf')
25-
DINF = decimal.Decimal("inf")
26-
DNINF = decimal.Decimal("-inf")
2723
FLOAT_MAX = sys.float_info.max
2824
FLOAT_MIN = sys.float_info.min
2925

@@ -481,10 +477,13 @@ def testCopysign(self):
481477
self.assertEqual(abs(math.copysign(2., NAN)), 2.)
482478

483479
def test_signbit(self):
484-
for arg in [0, 0., 1, 1., INF, NAN, DINF, DNAN]:
480+
self.assertRaises(TypeError, math.signbit)
481+
self.assertRaises(TypeError, math.signbit, '1.0')
482+
483+
for arg in [0, 0., 1, 1., INF, NAN]:
485484
with self.subTest('positive', arg=arg):
486485
self.assertFalse(math.signbit(arg))
487-
for arg in [-0., -1, -1., NINF, NNAN, DNINF, DNNAN]:
486+
for arg in [-0., -1, -1., NINF, NNAN]:
488487
with self.subTest('negative', arg=arg):
489488
self.assertTrue(math.signbit(arg))
490489

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
:mod:`math`: expose C99 :func:`~math.signbit` function to determine whether
2-
a floating-point value is negative. Patch by Bénédikt Tran.
2+
the sign bit of a floating-point value is set. Patch by Bénédikt Tran.

Modules/mathmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ math.signbit
12401240
x: double
12411241
/
12421242
1243-
Return True if 'x' is negative and False otherwise.
1243+
Return True if the sign of 'x' is negative and False otherwise.
12441244
12451245
This is useful to detect the sign bit of zeroes, infinities and NaNs.
12461246
[clinic start generated code]*/

0 commit comments

Comments
 (0)
0