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

Allow passing a custom epsilon to is_equal_approx() and is_zero_approx() #104408

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Dowsley
Copy link
Contributor

@Dowsley Dowsley commented Mar 20, 2025

Potential implementation for godotengine/godot-proposals#4425

This needs default arguments so its rebased off of #95017. So it needs that merged in first.

This effectively allows is_zero_approx to optionally receive a custom epsilon - allowing backwards compat.

And also adds is_equal_approx_custom_epsilon (surely we can improve this name) binding, that is basically an alternative to is_equal_approx if programmers wants to specify their own epsilon.

Example usage:
image
image

Doc changes:
image
image

@AThousandShips
Copy link
Member

This still breaks compatibility in a bad way because we can't bind compatibility methods for these cases, meaning it will work with GDScript but only GDScript, so this also needs that functionality to be added before this can be accepted (or existing GDExtension binds will break if they were compiled before this change)

@Dowsley
Copy link
Contributor Author

Dowsley commented Mar 21, 2025

needs that functionality to be added before

@AThousandShips You're talking about default arguments, but for compat methods? Or something else?

@AThousandShips
Copy link
Member

I'm talking about that this needs compatibility methods/binds which aren't implemented for these areas yet

@Dowsley
Copy link
Contributor Author

Dowsley commented Mar 21, 2025

I'm talking about that this needs compatibility methods/binds which aren't implemented for these areas yet

Understood, thanks. Is there any ongoing effort to solve this, or at least an Issue tracking it?

@AThousandShips
Copy link
Member

Not that I am aware of, the demand is very low and I think the solution is pretty complicated to implement

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.

Allow passing a custom epsilon to is_equal_approx() and is_zero_approx()
3 participants