Skip to content

Instantly share code, notes, and snippets.

@en0
Created November 10, 2018 15:55
Show Gist options
  • Save en0/bf585e2bc501b0e7fc6e9be638f8b482 to your computer and use it in GitHub Desktop.
Save en0/bf585e2bc501b0e7fc6e9be638f8b482 to your computer and use it in GitHub Desktop.
Compute equality on floating points within variance
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