Created
November 10, 2018 15:55
-
-
Save en0/bf585e2bc501b0e7fc6e9be638f8b482 to your computer and use it in GitHub Desktop.
Compute equality on floating points within variance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void eqish(f1, f2) { | |
static float e = 1.0e-nf; // where n is the precision | |
return abs((f1 - f2) < e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment