circuitpython/tests/perf_bench
Yoctopuce dev d6876e2273 py/obj: Fix REPR_C bias toward zero.
Current implementation of REPR_C works by clearing the two lower bits of
the mantissa to zero.  As this happens after each floating point operation,
this tends to bias floating point numbers towards zero, causing decimals
like .9997 instead of rounded numbers.  This is visible in test cases
involving repeated computations, such as `tests/misc/rge_sm.py` for
instance.

The suggested fix fills in the missing bits by copying the previous two
bits.  Although this cannot recreate missing information, it fixes the bias
by inserting plausible values for the lost bits, at a relatively low cost.

Some float tests involving irrational numbers have to be softened in case
of REPR_C, as the 30 bits are not always enough to fulfill the expectations
of the original test, and the change may randomly affect the last digits.
Such cases have been made explicit by testing for REPR_C or by adding a
clear comment.

The perf_test fft code was also missing a call to round() before casting a
log_2 operation to int, which was causing a failure due to a last-decimal
change.

Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
2025-07-24 11:07:30 +10:00
..
benchrun.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
bm_chaos.py tests/perf_bench: Skip bm_chaos test if random.randrange is unavailable. 2022-02-24 18:29:02 +11:00
bm_fannkuch.py tests/perf_bench: Add some configurations for N=32, M=10. 2022-06-28 10:32:18 +10:00
bm_fft.py py/obj: Fix REPR_C bias toward zero. 2025-07-24 11:07:30 +10:00
bm_float.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
bm_hexiom.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
bm_nqueens.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
bm_pidigits.py tests: Skip bm_pidigits perf test if no arbitrary precision int support. 2025-07-18 00:11:44 +10:00
bm_wordcount.py tests/perf_bench: Add string/qstr/map tests. 2023-10-27 16:16:08 +11:00
core_import_mpy_multi.py tests: Fix all file ioctl's to support only MP_STREAM_CLOSE. 2024-12-20 21:52:19 +11:00
core_import_mpy_multi.py.exp tests/perf_bench: Add perf tests for qstr interning and importing .mpy. 2022-02-10 15:25:33 +11:00
core_import_mpy_single.py tests: Fix all file ioctl's to support only MP_STREAM_CLOSE. 2024-12-20 21:52:19 +11:00
core_import_mpy_single.py.exp tests/perf_bench: Add perf tests for qstr interning and importing .mpy. 2022-02-10 15:25:33 +11:00
core_locals.py tests/perf_bench: Add string/qstr/map tests. 2023-10-27 16:16:08 +11:00
core_qstr.py tests/perf_bench: Add some configurations for N=32, M=10. 2022-06-28 10:32:18 +10:00
core_str.py tests/perf_bench: Add string/qstr/map tests. 2023-10-27 16:16:08 +11:00
core_yield_from.py tests/perf_bench: Add perf test for yield-from execution. 2022-02-11 13:42:00 +11:00
misc_aes.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
misc_mandel.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
misc_pystone.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
misc_raytrace.py all: Update Python formatting to latest Black version 22.1.0. 2022-02-02 16:49:55 +11:00
viper_call0.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
viper_call1a.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
viper_call1b.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
viper_call1c.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
viper_call2a.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
viper_call2b.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00