Skip to content

Add pow and powi support #23656

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

orejevich
Copy link

@orejevich orejevich commented Apr 26, 2025

This PR adds proper handling of comptime_float and comptime_int to std.math.pow and std.math.powi.

Changes:

  • pow now supports comptime_float by internally casting to f128 during computation
  • powi now supports comptime_int directly, with manual overflow and underflow checks
  • Matches existing behavior for runtime types, including special cases like 0^0 and negative exponents

Testing:

  • Added new tests for comptime_int and comptime_float
  • Verified all local tests pass for modified files

Let me know if anything should be adjusted — happy to tweak if needed!

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