#include <stdint.h>
#include <stdio.h>
-#include "util.h"
+#include "mtest.h"
static struct f_i t[] = {
#include "sanity/lroundf.h"
+#include "special/lroundf.h"
};
{
#pragma STDC FENV_ACCESS ON
long long yi;
- float d;
int e, i, err = 0;
struct f_i *p;
yi = lroundf(p->x);
e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
- if (!checkexcept(e, p->e, p->r)) {
+ if (!checkexcept(e, p->e, p->r) && (e|INEXACT) != p->e) {
printf("%s:%d: bad fp exception: %s lroundf(%a)=%lld, want %s",
p->file, p->line, rstr(p->r), p->x, p->i, estr(p->e));
printf(" got %s\n", estr(e));
err++;
}
- if (yi != p->i) {
+ if (!(p->e&INVALID) && yi != p->i) {
printf("%s:%d: %s lroundf(%a) want %lld got %lld\n",
p->file, p->line, rstr(p->r), p->x, p->i, yi);
err++;