Skip to content

Conversation

@ZERICO2005
Copy link
Contributor

@ZERICO2005 ZERICO2005 commented Feb 3, 2025

float fwrap(float x, float min, float max) {
    if (min > max)
        return fwrap(x, max, min);
    return (x >= 0 ? min : max) + fmodf(x, max - min);
}

This code when compiled with -Ofast (in C) would emit a lib-call to __frem instead of a call _fmodf. However, __frem wasn't defined in the toolchain. This has been fixed by adding the CRT routine for __frem, which wraps _fmodf for now.

Credit to @merthsoft for finding this bug

@adriweb adriweb merged commit 6ed5cbd into CE-Programming:master Feb 3, 2025
@adriweb adriweb mentioned this pull request Feb 3, 2025
5 tasks
@adriweb
Copy link
Member

adriweb commented Feb 3, 2025

(retval fixed by 82f472c)

@ZERICO2005 ZERICO2005 deleted the frem_fix branch April 16, 2025 04:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants