// Compile: cc -std=c23 test_7_6_fenv.c -lm
#include <fenv.h>
#include <math.h>
#include <assert.h>

int main(void) {
  if (fesetround(FE_DOWNWARD) == 0) {
    // nearbyint respects current rounding mode
    double y = nearbyint(0.5);
    assert(y == 0.0);
  }
  // restore to default if available
  fesetround(FE_TONEAREST);
  return 0;
}
