Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jepler
Copy link
Contributor

@jepler jepler commented Nov 13, 2025

Summary

In REPR_C, only 1/4 of all C float values can be expressed, depending on the least significant bits of the mantissa.

As an alternative to discarding the low bits, BOX_AS_NEEDED boxes values that would not otherwise be representable.

Testing

I ran the unix make VARIANT=longlong test locally, and ran ci stm32_misc_build to check that REPR_C builds without BOX_AS_NEEDED still compiled.

However, build-longlong/micropython -X emit=native tests/thread/stress_schedule.py consistently fails on my local system before and after this change so I wasn't able to run all longlong tests, just the make test ones.

Trade-offs and Alternatives

#18401 introduced a whole new REPR, a design which had some good points but which reduced the unboxed integer precision by 1 bit.

In REPR_C, only 1/4 of all C `float` values can be expressed,
depending on the least significant bits of the mantissa.

As an alternative to discarding the low bits, BOX_AS_NEEDED
boxes values that would not otherwise be representable.

Signed-off-by: Jeff Epler <[email protected]>
@codecov
Copy link

codecov bot commented Nov 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (2762fe6) to head (2b296ef).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #18413   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22294    22294           
=======================================
  Hits        21933    21933           
  Misses        361      361           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link

github-actions bot commented Nov 13, 2025

Code size report:

Reference:  esp32/boards: Add Silicognition ManT1S board definition. [27544a2]
Comparison: ci: Correct a typo. [merge of 2b296ef]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@jepler
Copy link
Contributor Author

jepler commented Nov 13, 2025

Reference:  tests/serial_test.py: Allow up to 2 seconds between bytes. [2762fe680a]
Comparison: float: Introduce MICROPY_FLOAT_BOX_AS_NEEDED. [c0c76ffa3]
unix longlong: +1148 +0.164% longlong[incl +32(data)]

Signed-off-by: Jeff Epler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant