Skip to content

fix: return infinity for hypot overflow#141

Open
bhagy-patel1 wants to merge 2 commits into
Rinzii:mainfrom
bhagy-patel1:fix/hypot-overflow
Open

fix: return infinity for hypot overflow#141
bhagy-patel1 wants to merge 2 commits into
Rinzii:mainfrom
bhagy-patel1:fix/hypot-overflow

Conversation

@bhagy-patel1

Copy link
Copy Markdown

Summary

Fix overflow handling in hypot.

Previously, when the true result exceeded the maximum
representable floating-point value, the implementation
returned the largest finite value instead of +inf.

This change adds an overflow check and returns +inf
to match the behavior of std::hypot. A regression
test for the overflow boundary case has also been added.

Closes #137

@bhagy-patel1 bhagy-patel1 requested a review from Rinzii as a code owner June 13, 2026 12:36
@bhagy-patel1 bhagy-patel1 reopened this Jun 13, 2026

@Rinzii Rinzii left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hello!

I firstly want to thank you for taking the time to contribute to CCMath. Your work is greatly appreciated!

Currently, GH has made a change to there windows runners that the main has not yet addressed but the dev branch does. Could you update this PR to follow the dev branch instead of the main branch? (I plan to have these issues with the main addressed in the current major PR I am working on for v0.3.0 but I am not yet ready for this)

@Rinzii

Rinzii commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Hello!

I firstly want to thank you for taking the time to contribute to CCMath. Your work is greatly appreciated!

Currently, GH has made a change to there windows runners that the main has not yet addressed but the dev branch does. Could you update this PR to follow the dev branch instead of the main branch? (I plan to have these issues with the main addressed in the current major PR I am working on for v0.3.0 but I am not yet ready for this)

Ok I actually committed my PR to the main branch as I am planning to get rid of the dev branch currently. So now all I need is for you to resolve all merge conflicts and I can properly review your code. ^^

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.

[BUG]: hypot generic kernel returns max-finite instead of inf at the overflow boundary

2 participants