1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#include <ieeefp.h>
#include <machine/registers.h>
fp_except _DEFUN(fpsetmask,(newmask),
fp_except newmask)
{
fp_except oldmask;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldmask = tkcw.fp_trap;
tkcw.fp_trap = newmask;
sysv60(0, 8, &tkcw);
return oldmask;
}
fp_except fpgetmask (void)
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.fp_trap;
}
fp_rnd fpgetround (void)
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.fp_rounding;
}
fp_rnd _DEFUN(fpsetround,(rnd),
fp_rnd rnd)
{
fp_rnd oldrnd;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldrnd = tkcw.fp_rounding;
tkcw.fp_rounding = rnd;
sysv60(0, 8, &tkcw);
return oldrnd;
}
fp_rdi fpgetroundtoi (void)
{
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
return tkcw.integer_rounding;
}
fp_rdi _DEFUN(fpsetroundtoi,(rnd),
fp_rdi rnd)
{
fp_rdi oldrnd;
v60_tkcw_type tkcw;
sysv60(0, 8, &tkcw);
oldrnd = tkcw.integer_rounding;
tkcw.integer_rounding = rnd;
sysv60(0, 8, &tkcw);
return oldrnd;
}
|