File: softfloat.h

package info (click to toggle)
faumachine 20180503-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 61,272 kB
  • sloc: ansic: 272,290; makefile: 6,199; asm: 4,251; sh: 3,022; perl: 886; xml: 563; pascal: 311; lex: 214; vhdl: 204
file content (209 lines) | stat: -rw-r--r-- 5,274 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
 * Copyright (C) 2016 FAUmachine Team <info@faumachine.org>.
 * This program is free software. You can redistribute it and/or modify it
 * under the terms of the GNU General Public License, either version 2 of
 * the License, or (at your option) any later version. See COPYING.
 */

#include <inttypes.h>

typedef float float32;
typedef double float64;
typedef long double float80;

/*
 * Exams
 */
extern int
float80_isneg(float80 f);
extern int
float80_iszero(float80 f);
extern int
float80_isnorm(float80 f);
extern int
float80_isdenorm(float80 f);
extern int
float80_isinf(float80 f);
extern int
float80_isnan(float80 f);

/*
 * Comparisons
 */
extern int
float80_isless(float80 a, float80 b);
extern int
float80_isunordered(float80 a, float80 b);

/*
 * Constants
 */
extern float80
float80_0(void);
extern float80
float80_1(void);
extern float80
float80_l2t(void);
extern float80
float80_l2e(void);
extern float80
float80_pi(void);
extern float80
float80_lg2(void);
extern float80
float80_ln2(void);

/*
 * Conversions
 */
extern float80
float80_from_i16(int16_t val);
extern int16_t
float80_to_i16(uint8_t rc, float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_from_i32(int32_t val);
extern int32_t
float80_to_i32(uint8_t rc, float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_from_i64(int64_t val);
extern int64_t
float80_to_i64(uint8_t rc, float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_from_f32(float32 val);
extern float32
float80_to_f32(uint8_t rc, float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_from_f64(float64 val);
extern float64
float80_to_f64(uint8_t rc, float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
float80
float80_from_bcd(uint8_t *src);
extern void
float80_to_bcd(uint8_t *dst,
		uint8_t rc,
		float80 val,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);

/*
 * Unary Functions
 */
extern float80
float80_chs(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_abs(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_sqrt(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_tan(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_atan(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_sin(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_cos(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern void
float80_sincos(int rc, int pc, float80 *res1p, float80 *res2p, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_2xm1(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_rndint(int rc, int pc, float80 a,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);

/*
 * Binary Functions
 */
extern float80
float80_scale(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_fprem(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep,
		uint8_t *c0, uint8_t *c1,
		uint8_t *c2, uint8_t *c3);
extern float80
float80_fprem1(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep,
		uint8_t *c0, uint8_t *c1,
		uint8_t *c2, uint8_t *c3);
extern float80
float80_yl2x(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_yl2xp1(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_add(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_sub(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_mul(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);
extern float80
float80_div(int rc, int pc, float80 a, float80 b,
		uint8_t *pep, uint8_t *uep,
		uint8_t *oep, uint8_t *zep,
		uint8_t *dep, uint8_t *iep);