Skip to content
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

math: speedup pow for non-fractional powers #19270

Merged
merged 3 commits into from
Sep 4, 2023

Conversation

Le0Developer
Copy link
Member

@Le0Developer Le0Developer commented Sep 4, 2023

This adds shortcuts for math.pow(x, 2.0) and math.pow(x, 3.0) as well as a generic version for any non-fractional power.

Also update math's ROADMAP.md file, the features have long been implemented.
Motivation can be found on the Discord server here (replacing math.pow(x, 2) with x * x resulted in a 13x speedup).

🤖 Generated by Copilot at 7730caf

This pull request enhances the pow function in vlib/math by adding more tests, optimizing the implementation, and updating the ROADMAP.md file.

🤖 Generated by Copilot at 7730caf

  • Implement pow in pure V for integer exponents (link,link)
  • Add more test cases for pow with positive and negative integer exponents (link,link)
  • Mark log and pow tasks as completed in vlib/math/ROADMAP.md (link)

Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

@spytheman spytheman merged commit a3fa575 into vlang:master Sep 4, 2023
42 checks passed
@Le0Developer Le0Developer deleted the speedup/math-pow branch September 4, 2023 15:37
Wertzui123 pushed a commit to Wertzui123/v that referenced this pull request Oct 8, 2023
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.

None yet

2 participants