-
Notifications
You must be signed in to change notification settings - Fork 48
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
PRVM: Return NaN/inf values for divisions by zero. #246
base: master
Are you sure you want to change the base?
Conversation
We really should divide three times separately than compute the reciprocal and multiply by that three times. The latter allows two roundoff errors, the former only one.
…ot 0. For now the division by zero warning is kept. The old behavior is behind a cvar `prvm_gameplayfix_div0is0` to enable in case this causes any trouble for anyone. Fixed #240.
Compiles fine, and no crashes, but I don't see the new cvar, and doing |
Thanks; as for testing, you can't just write To have a good chance of testing this, add to your game:
Then launch a game and perform on the console:
I have not tested it yet, but this is the expected outcome. |
Testing it myself now, now that I've written that code anyway. When using a more modern compiler, one can skip the cvar_set calls and just use:
|
Yes, just confirmed it myself. As a minor difference from expectations, DP prints |
To be clear, the expectations are:
Generating a working -0 is left as an exercise to the reader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and working as documented in the PR comments.
Also improve accuracy of
DIV_VF
a bit.This matches FTEQW.