Skip to content

py/objint_longlong: Fix longlong interoperability with floats. #17740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2025

Conversation

yoctopuce
Copy link
Contributor

Summary

Current longlong implementation does not allow a float as RHS of mathematic operators, as it lacks the delegation code present in mpz. This was mentionned in in #16953 but postponed to a separate PR.

Testing

Test cases similar to int_big have been createt for int_64. The only test case which was not included is the complex test case, as small ports may not include complex support (eg. zephir).
The code has been tested on unix/longlong variant of development branch.

Trade-offs and Alternatives

This fixes a serious limitation of current longlong implementation, so I guess there isn't any tradeoff.

Copy link

codecov bot commented Jul 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (3c69277) to head (3a72f95).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #17740   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22240    22240           
=======================================
  Hits        21881    21881           
  Misses        359      359           

☔ 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.

Copy link

Code size report:

   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

@yoctopuce
Copy link
Contributor Author

@dpgeorge @projectgus
The failing test is a false positive, so this code is ready for review.

@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Jul 23, 2025
@yoctopuce yoctopuce force-pushed the fix_longlong_float_support branch from 5b01728 to 3e3243a Compare July 24, 2025 10:56
@yoctopuce
Copy link
Contributor Author

rebased to master

Copy link
Member

@dpgeorge dpgeorge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thanks. It matches the logic in the mpz binary-op implementation.

Current longlong implementation does not allow a float as RHS of mathematic
operators, as it lacks the delegation code present in mpz.

Signed-off-by: Yoctopuce dev <dev@yoctopuce.com>
@dpgeorge dpgeorge force-pushed the fix_longlong_float_support branch from 3e3243a to 3a72f95 Compare July 28, 2025 15:14
@dpgeorge dpgeorge merged commit 3a72f95 into micropython:master Jul 28, 2025
67 of 68 checks passed
@yoctopuce yoctopuce deleted the fix_longlong_float_support branch July 28, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
py-core Relates to py/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants