Skip to content

Instantly share code, notes, and snippets.

@mikhailramalho
Created October 4, 2016 13:37
Show Gist options
  • Save mikhailramalho/2d2bf89cf85fe21f8d64de64d7d089ba to your computer and use it in GitHub Desktop.
Save mikhailramalho/2d2bf89cf85fe21f8d64de64d7d089ba to your computer and use it in GitHub Desktop.
#include <assert.h>
#include <math.h>
#include <fenv.h>
int main (void) {
float f;
float g;
__ESBMC_assume(!isnan(f));
__ESBMC_assume(!isnan(g));
if (f > g) {
fesetround(FE_UPWARD);
}
if (f < g) {
fesetround(FE_DOWNWARD);
}
if ((!isinf(f)) && (g > 0.0f)) {
float h = f + g;
assert(h >= f);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment