Comments (4)
from cpython.
This was originally submitted by Nadav Horesh <[email protected]>.
Tim, I have a document for you, but it's in TeX. Do you want the raw TeX source or can you read a DVI file?
from cpython.
Checked in now.
from cpython.
Accepted (but reluctantly; see below), and assigned back to Guido for checkin.
cmathmodule is not production quality, and this patch isn't either, but its asinh and acosh are better than what's there now.
The author avoided some of the numerical foolishness in the original, but didn't avoid all of it. For example, it's harder to get asinh to do something ridiculous now than it was before, but still possible:
>>> cmath.acosh(1e200)
(461.210165779+0j)
>>> cmath.asinh(1e200)
(1.#INF+0j)
>>>
asinh should have returned something approximately equal to what acosh returned.
That may not be the patch's problem, though! I suspect that's due to one of the module's other functions that's too naive about the limits of floating point. In any case, it is *much* easier to provoke the current cmath functions into cases like this one.
Another possible problem has to do with principal values. My reference books are in storage, so about the best I can do right now is compare what this code does to Macsyma (which I have on my laptop). The acosh in this patch often returns the negative of what Macysma computes. For example,
>>> cmath.acosh(-1-1j)
(1.06127506191-2.23703575929j)
>>>
Macsyma returns the negation of that. On the other hand, the *original* acosh doesn't agree with Macsyma on some signs where this acosh does. So call this one a wash.
I may have mentioned this before <wink>: robust math libraries are extremely difficult to get right. It would take several months to write a production-quality cmath module from scratch, which is several months more than were devoted to Python's current cmath <wink>. I vote we check this in anyway (since it *is*, overall, an improvement), and look into borrowing some other language's complex math library later (note in particular that C9X adds complex numbers and these functions on them, so if we sit on our asses long enough, we can inherit libc's!).
from cpython.
Related Issues (20)
- TSan: data race in pending calls HOT 6
- TSan: data race with PyTypeObject version tag HOT 2
- TSan: data race with _PyThreadState_Attach and _PyThreadState_Detach HOT 2
- TSan: data race accessing socket fd HOT 3
- ``test_capi`` leaks references HOT 4
- Why do we have two counters for function versions? HOT 1
- بيثو HOT 2
- 116 HOT 3
- tarfile.py: TarFile.addfile not adding all files HOT 3
- docs (easy): Add reference to the Python docs theme gh repo
- docs(easy): Document that heap types need to support garbage collection HOT 3
- C API: Add PyType_GetModuleByDef() to the limited C API version 3.13 HOT 6
- `dict` and `dict.update` treat the first argument as a mapping when it has attribute `keys` without attribute `__getitem__` HOT 7
- Rewrite binarysort() HOT 9
- `./Include/cpython/pyatomic_std.h` will not compile HOT 3
- `makesetup` to allow missing ending line break for `Setup` files
- Heap types implemented in C must have Py_TPFLAGS_HAVE_GC and implement tp_traverse HOT 2
- configparser.DuplicateOptionError leaves ConfigParser instance in bad state HOT 1
- json decode error in case of trailing comma is misleading HOT 2
- Error in Modules/zlibmodule.c when compling cpython from source code HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.