summaryrefslogtreecommitdiff
path: root/numpy/add_newdocs.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-05-28 23:56:45 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-05-28 23:56:45 -0700
commit93e79a1a6708eebab6adc734f36e4e08c093aee0 (patch)
tree976183d76de6a6e159bba62a210a8415a21bf3a5 /numpy/add_newdocs.py
parent09e108dc3453cbca17a80e75f5ec2b941e5b8137 (diff)
downloadnumpy-93e79a1a6708eebab6adc734f36e4e08c093aee0.tar.gz
TST: Add np.core._multiarray_tests.format_float_OSprintf_g
For development/testing purposes, it's convenient to have access to the system printf for floats. This is a very simple printf interface.
Diffstat (limited to 'numpy/add_newdocs.py')
-rw-r--r--numpy/add_newdocs.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/numpy/add_newdocs.py b/numpy/add_newdocs.py
index fc2130096..9372b3431 100644
--- a/numpy/add_newdocs.py
+++ b/numpy/add_newdocs.py
@@ -5607,6 +5607,37 @@ add_newdoc('numpy.core.multiarray', 'unpackbits',
""")
+add_newdoc('numpy.core._multiarray_tests', 'format_float_OSprintf_g',
+ """
+ format_float_OSprintf_g(val, precision)
+
+ Print a floating point scalar using the system's printf function,
+ equivalent to:
+
+ printf("%.*g", precision, val);
+
+ for half/float/double, or replacing 'g' by 'Lg' for longdouble. This
+ method is designed to help cross-validate the format_float_* methods.
+
+ Parameters
+ ----------
+ val : python float or numpy floating scalar
+ Value to format.
+
+ precision : non-negative integer, optional
+ Precision given to printf.
+
+ Returns
+ -------
+ rep : string
+ The string representation of the floating point value
+
+ See Also
+ --------
+ format_float_scientific
+ format_float_positional
+ """)
+
##############################################################################
#