mirror of
https://github.com/ksherlock/mpw.git
synced 2024-12-26 11:30:25 +00:00
more SANE tests.
This commit is contained in:
parent
8c911ab83d
commit
48d869c6e8
2
libsane
2
libsane
@ -1 +1 @@
|
||||
Subproject commit b12ef7bcd2e1ac8cea52a8cef6cef6b2960f143b
|
||||
Subproject commit 9c2af7c48dcbb58a5af436c295e83643c7f33f8b
|
@ -46,7 +46,7 @@ clean :
|
||||
# mpw Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
||||
test_sane: o/nan.o o/test_sane.o
|
||||
$(MPW) $(MPWFLAGS) Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
$(MPW) $(MPWFLAGS) Link $(LDFLAGS) -o $@ $^ $(LIBS) {CLibraries}CSANELib.o
|
||||
|
||||
% : o/%.o
|
||||
$(MPW) $(MPWFLAGS) Link $(LDFLAGS) -o $@ $^ $(LIBS)
|
||||
|
@ -270,6 +270,87 @@ void test_fxc2dec(void)
|
||||
num2dec(&df, 1.0625, &d);
|
||||
dump_decimal(&d);
|
||||
// s/b -6 1062500
|
||||
}
|
||||
|
||||
pascal void fp68k_3(void *, void *, unsigned short) = 0xA9EB;
|
||||
|
||||
void test_fx2l(void) {
|
||||
|
||||
long double x;
|
||||
long int l;
|
||||
int i;
|
||||
|
||||
static long double data[] = {
|
||||
1.25,
|
||||
1.5,
|
||||
1.75,
|
||||
2.25,
|
||||
2.5,
|
||||
2.75,
|
||||
-1.25,
|
||||
-1.5,
|
||||
-1.75,
|
||||
-2.25,
|
||||
-2.5,
|
||||
-2.75,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
x = inf(); // 1.0 / 0.0;
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(inf) = %lx\n", l);
|
||||
|
||||
|
||||
x = -inf(); // -1.0 / 0.0;
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(-inf) = %lx\n", l);
|
||||
|
||||
x = nan(1); // -1.0 / 0.0;
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(nan) = %lx\n", l);
|
||||
|
||||
|
||||
x = 1e21;
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(1e21) = %lx\n", l);
|
||||
|
||||
x = -1e21;
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(-1e21) = %lx\n", l);
|
||||
|
||||
|
||||
|
||||
setround(UPWARD);
|
||||
for (i = 0; i < 12; ++i) {
|
||||
x = data[i];
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(%f) = %ld\n", x, l);
|
||||
}
|
||||
setround(DOWNWARD);
|
||||
for (i = 0; i < 12; ++i) {
|
||||
x = data[i];
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(%f) = %ld\n", x, l);
|
||||
}
|
||||
|
||||
setround(TONEAREST);
|
||||
for (i = 0; i < 12; ++i) {
|
||||
x = data[i];
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(%f) = %ld\n", x, l);
|
||||
}
|
||||
setround(TOWARDZERO);
|
||||
for (i = 0; i < 12; ++i) {
|
||||
x = data[i];
|
||||
fp68k_3(&x, &l, 0x2810);
|
||||
printf("fx2l(%f) = %ld\n", x, l);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@ -293,6 +374,7 @@ int main(int argc, char **argv)
|
||||
test_nan();
|
||||
|
||||
test_fxc2dec();
|
||||
test_fx2l();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user