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

Add is_finite method for checking built-in types #64268

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

timothyqiu
Copy link
Member

Resolves godotengine/godot-proposals#3790

This also makes fixing NAN/INF related crashes easier.

is_finite is not added for Color because a finite color sounds weird.

@timothyqiu timothyqiu added this to the 4.x milestone Aug 11, 2022
@timothyqiu timothyqiu requested review from a team as code owners August 11, 2022 09:18
@dalexeev
Copy link
Member

It makes sense to rename is_inf to is_infinite.

@timothyqiu
Copy link
Member Author

timothyqiu commented Aug 11, 2022

It makes sense to rename is_inf to is_infinite.

Yeah. But I think renaming it is out of the scope of this PR.

The naming is currently similar to C++ which provides both isinf() and isfinite() :P

Copy link
Member

@lawnjelly lawnjelly left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@akien-mga akien-mga modified the milestones: 4.x, 4.0 Oct 11, 2022
@akien-mga akien-mga merged commit 58eff50 into godotengine:master Oct 11, 2022
@akien-mga
Copy link
Member

Thanks!

Comment on lines +694 to +696
bool Basis::is_finite() const {
return rows[0].is_finite() && rows[1].is_finite() && rows[2].is_finite();
}
Copy link
Member

@aaronfranke aaronfranke Oct 11, 2022

Choose a reason for hiding this comment

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

Considering you can validate a Basis by checking its determinant, I'm not sure this is helpful. The same likely applies to several other structures, there are other ways to validate them. But I guess it's fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a new 'is_finite' method for checking built-in types
5 participants