This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
| Author | mark.dickinson |
|---|---|
| Recipients | Rhamphoryncus, christian.heimes, gmcastil, gvanrossum, mark.dickinson, tim.peters |
| Date | 2008年01月20日.16:11:34 |
| SpamBayes Score | 0.013242014 |
| Marked as misclassified | No |
| Message-id | <1200845497.42.0.693264014775.issue1640@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
One question: is there a policy on what should happen for singularities and domain errors? If not, I think it would be useful to have one. Following the policy may not be achievable on all platforms, but it should be easy to do on major platforms, and at least we'll know what we're aiming for in general. Maybe it already exists, and I missed it :) For domain errors (e.g. sqrt(-1), log(-1), acosh(0)), the obvious two options are: - raise an exception (e.g. OverflowError), or - return a NaN For singularities (e.g. log(0), atanh(1)), the options are basically the same: - raise an exception (preferably something different from OverflowError), or - return the IEEE-754 recommended value (usually +/-Inf) I suspect there are use-cases for both types of behaviour here. Of course, the *right* thing to do, in some sense, would be to have a thread-local floating-point environment that makes it possible for the user to choose whether he/she wants an exception or a special value, much like the way Decimal behaves at the moment. But that would be a big change, almost certainly requiring a PEP and a lot of work. A few months ago I definitely would have said that an exception should be raised in both cases, as already happens (mostly); but since then NaNs and Infinities have acquired greater legitimacy within Python. Tim, if you're listening: any words of wisdom? Should I ask this on python-dev? |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008年01月20日 16:11:37 | mark.dickinson | set | spambayes_score: 0.013242 -> 0.013242014 recipients: + mark.dickinson, gvanrossum, tim.peters, Rhamphoryncus, christian.heimes, gmcastil |
| 2008年01月20日 16:11:37 | mark.dickinson | set | spambayes_score: 0.013242 -> 0.013242 messageid: <1200845497.42.0.693264014775.issue1640@psf.upfronthosting.co.za> |
| 2008年01月20日 16:11:36 | mark.dickinson | link | issue1640 messages |
| 2008年01月20日 16:11:34 | mark.dickinson | create | |