circuitpython/tests/misc
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
..
sys_settrace_subdir py/profile: Remove the requirement to disable MICROPY_COMP_CONST. 2023-08-30 10:58:04 +10:00
cexample_class.py examples/usercmodule/cexample: Add more advanced native class. 2024-07-25 11:57:13 +10:00
cexample_class.py.exp examples/usercmodule/cexample: Add more advanced native class. 2024-07-25 11:57:13 +10:00
cexample_module.py examples/usercmodule/cexample: Add more advanced native class. 2024-07-25 11:57:13 +10:00
cexample_module.py.exp tests/misc/cexample_module: Test class presence. 2022-11-25 08:13:15 +01:00
cexample_subclass.py py/objtype: Avoid crash on calling members of uninitialized native type. 2024-07-25 12:01:43 +10:00
cexample_subclass.py.exp py/objtype: Avoid crash on calling members of uninitialized native type. 2024-07-25 12:01:43 +10:00
features.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
non_compliant.py py/objstr: Support tuples and start/end args in startswith and endswith. 2025-03-02 22:15:31 +11:00
non_compliant.py.exp py/objstr: Support tuples and start/end args in startswith and endswith. 2025-03-02 22:15:31 +11:00
non_compliant_lexer.py tests: Format all Python code with black, except tests in basics subdir. 2020-03-30 13:21:58 +11:00
non_compliant_lexer.py.exp py/lexer: Raise NotImplError for unicode name escape, instead of assert. 2015-09-07 17:08:49 +01:00
print_exception.py tests/run-tests.py: Automatically skip tests that are too large. 2025-06-05 15:15:31 +10:00
rge_sm.py py/obj: Fix REPR_C bias toward zero. 2025-07-24 11:07:30 +10:00
sys_atexit.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
sys_atexit.py.exp tests/misc/sys_atexit: Add test for new sys.atexit feature. 2019-08-15 17:31:04 +10:00
sys_exc_info.py tests: Replace umodule with module everywhere. 2023-06-08 17:54:24 +10:00
sys_settrace_cov.py tests/misc: Improve test coverage of py/profile.c. 2025-07-06 00:05:36 +10:00
sys_settrace_cov.py.exp tests/misc: Improve test coverage of py/profile.c. 2025-07-06 00:05:36 +10:00
sys_settrace_features.py tests/misc/sys_settrace_features.py: Add note about CPython 3.12 issue. 2024-11-28 23:11:36 +11:00
sys_settrace_generator.py top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
sys_settrace_generator.py.exp top: Update Python formatting to black "2023 stable style". 2023-02-02 12:51:03 +11:00
sys_settrace_loop.py tests/misc/sys_settrace: Make test output independent of invoked path. 2020-12-18 13:56:45 +11:00
sys_settrace_loop.py.exp tests/misc/sys_settrace: Make test output independent of invoked path. 2020-12-18 13:56:45 +11:00