Skip to content

examples: Fix float division#15647

Merged
slouken merged 1 commit into
libsdl-org:mainfrom
DevLyas:fix-examples-float-division
May 18, 2026
Merged

examples: Fix float division#15647
slouken merged 1 commit into
libsdl-org:mainfrom
DevLyas:fix-examples-float-division

Conversation

@DevLyas
Copy link
Copy Markdown
Contributor

@DevLyas DevLyas commented May 18, 2026

Avoid integer division before conversion to float in the examples to prevent precision loss warnings.

@slouken slouken merged commit b5ac641 into libsdl-org:main May 18, 2026
47 checks passed
@Semphriss
Copy link
Copy Markdown
Contributor

Small detail: Casting to float after dividing has the benefit of automatically rounding, which avoids off-pixel rendering. I'm not sure if this is relevant or meaningful in those cases, just wanted to raise this up in case the precision loss was intended.

@DevLyas DevLyas deleted the fix-examples-float-division branch May 18, 2026 16:47
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