circuitpython/tests/float
Dan Ellis f9cbe6bc47 py/formatfloat: Format all whole-number floats exactly.
Formerly, py/formatfloat would print whole numbers inaccurately with
nonzero digits beyond the decimal place.  This resulted from its strategy
of successive scaling of the argument by 0.1 which cannot be exactly
represented in floating point.  The change in this commit avoids scaling
until the value is smaller than 1, so all whole numbers print with zero
fractional part.

Fixes issue #4212.

Signed-off-by: Dan Ellis dan.ellis@gmail.com
2022-07-26 22:23:47 +10:00
..
array_construct.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_abs.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_hash.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_minmax.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_pow.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_round.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
builtin_float_round_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
bytearray_construct_endian.py tests/float: Make bytes/bytearray construct tests work with obj repr C. 2021-06-18 14:16:07 +10:00
bytes_construct_endian.py tests/float: Make bytes/bytearray construct tests work with obj repr C. 2021-06-18 14:16:07 +10:00
cmath_dunder.py py/obj: Make mp_obj_get_complex_maybe call mp_obj_get_float_maybe first. 2022-07-25 16:11:26 +10:00
cmath_fun.py all: Update Python code to conform to latest black formatting. 2020-08-29 15:18:01 +10:00
cmath_fun_special.py tests/float: Fix cmath_fun_special for MICROPY_FLOAT_IMPL_FLOAT. 2020-04-18 22:36:49 +10:00
complex1.py py/parsenum: Fix parsing of complex "j" and also "nanj", "infj". 2022-06-23 11:46:47 +10:00
complex1_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
complex_dunder.py py/obj: Make mp_obj_get_complex_maybe call mp_obj_get_float_maybe first. 2022-07-25 16:11:26 +10:00
complex_reverse_op.py tests: Split out complex reverse-op tests to separate test file. 2020-08-29 14:12:20 +10:00
complex_special_methods.py tests: Split out complex reverse-op tests to separate test file. 2020-08-29 14:12:20 +10:00
float1.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
float2int_doubleprec_intbig.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
float2int_fp30_intbig.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
float2int_intbig.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
float_array.py tests: Make float and framebuf tests skip or run on big-endian archs. 2021-05-26 16:33:18 +10:00
float_compare.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_divmod.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_divmod_relaxed.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_dunder.py py/obj: Add support for __float__ and __complex__ functions. 2022-07-25 14:23:34 +10:00
float_format.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_format_ftoe.py py/formatfloat: Format all whole-number floats exactly. 2022-07-26 22:23:47 +10:00
float_format_ftoe.py.exp py/formatfloat: Format all whole-number floats exactly. 2022-07-26 22:23:47 +10:00
float_format_ints.py py/formatfloat: Format all whole-number floats exactly. 2022-07-26 22:23:47 +10:00
float_format_ints_doubleprec.py py/formatfloat: Format all whole-number floats exactly. 2022-07-26 22:23:47 +10:00
float_parse.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_parse_doubleprec.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
float_struct.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
inf_nan_arith.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
int_big_float.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
int_divzero.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
int_power.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
lexer.py tests/float: Add new lexer test to test parsing of float without prefix. 2020-03-30 13:23:05 +11:00
list_index.py tests: Rename test scripts, changing - to _ for consistency. 2014-07-05 06:14:29 +01:00
math_constants.py py/modmath: Add math.tau, math.nan and math.inf constants. 2022-01-23 09:28:33 +11:00
math_constants_extra.py py/modmath: Add math.tau, math.nan and math.inf constants. 2022-01-23 09:28:33 +11:00
math_domain.py py: Fix handling of NaN in certain pow implementations. 2020-09-11 10:04:57 +10:00
math_domain_special.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_dunder.py py/obj: Make mp_obj_get_complex_maybe call mp_obj_get_float_maybe first. 2022-07-25 16:11:26 +10:00
math_factorial_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_fun.py all: Update Python code to conform to latest black formatting. 2020-08-29 15:18:01 +10:00
math_fun_bool.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_fun_int.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_fun_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_fun_special.py all: Update Python code to conform to latest black formatting. 2020-08-29 15:18:01 +10:00
math_isclose.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
math_isclose.py.exp py/modmath: Implement math.isclose() for non-complex numbers. 2019-08-17 23:23:17 +10:00
python36.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
python36.py.exp py/lexer: Add support for underscores in numeric literals. 2018-06-12 12:17:43 +10:00
string_format.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format2.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_fp30.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_modulo.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_modulo2.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_modulo2_intbig.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_modulo3.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
string_format_modulo3.py.exp py/formatfloat: Fix number of digits and exponent sign when rounding. 2017-06-13 13:36:56 +10:00
true_value.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
types.py tests: Split out those tests requiring float and import. 2014-04-17 16:21:43 +01:00