classification
Title: math.degrees(sys.float_info.max) should throw an OverflowError exception
Type: Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: anthonypjshaw, franciscouzo, mark.dickinson, rhettinger
Priority: normal Keywords: patch

Created on 2016-10-26 21:25 by franciscouzo, last changed 2019-05-06 18:29 by anthonypjshaw.

Files
File name Uploaded Description Edit
math-degrees-overflow.diff mark.dickinson, 2016-10-27 17:47 review
Messages (5)
msg279513 - (view) Author: Francisco Couzo (franciscouzo) * Date: 2016-10-26 21:25
Most functions in the math library raise an OverflowError when the arguments are finite but the result is not.

>>> math.exp(sys.float_info.max)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: math range error

>>> math.degrees(sys.float_info.max)
inf
msg279535 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-10-27 11:52
I agree in principle.

On one hand, it's difficult to care too much, since `math.degrees` is going to be all-but-useless for inputs larger than `1e20` or so anyway (the actual angle represented is getting lost in floating-point noise by that point).

OTOH, *because* of the above, at least making the change shouldn't break any code that wasn't broken already.
msg279536 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-10-27 12:26
Francisco: would you be interested in writing a patch?
msg279555 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2016-10-27 17:47
Actually, here's a patch.
msg341588 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2019-05-06 18:29
Francisco, I recommend converting the patch into a GitHub pull request to make it easier to code review.

Mark, Raymond, please could you re-review this patch.
History
Date User Action Args
2019-05-06 18:29:54anthonypjshawsetnosy: + rhettinger, anthonypjshaw
messages: + msg341588
2016-10-27 17:47:27mark.dickinsonsetfiles: + math-degrees-overflow.diff
keywords: + patch
messages: + msg279555
2016-10-27 12:26:29mark.dickinsonsetmessages: + msg279536
2016-10-27 11:52:22mark.dickinsonsetnosy: + mark.dickinson
messages: + msg279535
2016-10-26 21:25:41franciscouzocreate