From 93e79a1a6708eebab6adc734f36e4e08c093aee0 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 28 May 2018 23:56:45 -0700 Subject: 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. --- numpy/add_newdocs.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'numpy/add_newdocs.py') 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 + """) + ############################################################################## # -- cgit v1.2.1