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

Preserve input type in math functions #13041

Merged
merged 1 commit into from
Nov 14, 2024
Merged

Preserve input type in math functions #13041

merged 1 commit into from
Nov 14, 2024

Conversation

KN4CK3R
Copy link
Contributor

@KN4CK3R KN4CK3R commented Nov 14, 2024

The docs of add tell us

If one of the numbers is a float, the result is a float.

which is not true if two zeros are added because internally != 0 is used as implicit type check.
So add (0 | float) (0 | float) returns an int zero.

This PR remembers the input types and uses the correct type for the return value.

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2024

CLA assistant check
All committers have signed the CLA.

@bep bep merged commit 23d21b0 into gohugoio:master Nov 14, 2024
6 checks passed
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.

3 participants