diff options
author | Warren Weckesser <warren.weckesser@gmail.com> | 2019-10-23 18:25:10 -0400 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2019-10-23 18:25:10 -0400 |
commit | 263789965f4012c0f27080b00de6936f0cc5ce99 (patch) | |
tree | 403679e6dd25e098cb0f44f144a2f7dcba27d46a | |
parent | 20a2f8b5e953beca5d76960cbe130ebc96bd8668 (diff) | |
download | numpy-263789965f4012c0f27080b00de6936f0cc5ce99.tar.gz |
MAINT: doc: Refer to _rational_tests.c.src in the user-defined types section.
Also removed a few sentence written in the first person that express
opinions about the code.
-rw-r--r-- | doc/source/user/c-info.beyond-basics.rst | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/doc/source/user/c-info.beyond-basics.rst b/doc/source/user/c-info.beyond-basics.rst index dd25861b4..62e8139fe 100644 --- a/doc/source/user/c-info.beyond-basics.rst +++ b/doc/source/user/c-info.beyond-basics.rst @@ -217,14 +217,13 @@ type will behave much like a regular data-type except ufuncs must have 1-d loops registered to handle it separately. Also checking for whether or not other data-types can be cast "safely" to and from this new type or not will always return "can cast" unless you also register -which types your new data-type can be cast to and from. Adding -data-types is one of the less well-tested areas for NumPy 1.0, so -there may be bugs remaining in the approach. Only add a new data-type -if you can't do what you want to do using the OBJECT or VOID -data-types that are already available. As an example of what I -consider a useful application of the ability to add data-types is the -possibility of adding a data-type of arbitrary precision floats to -NumPy. +which types your new data-type can be cast to and from. + +The NumPy source code includes an example of a custom data-type as part +of its test suite. The file ``_rational_tests.c.src`` in the source code +directory ``numpy/numpy/core/src/umath/`` contains an implementation of +a data-type that represents a rational number as the ratio of two 32 bit +integers. .. index:: pair: dtype; adding new |