Subversion Repositories tendra.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*
32
$Log: flpttypes.h,v $
33
 * Revision 1.1.1.1  1998/01/17  15:56:02  release
34
 * First version to be checked into rolling release.
35
 *
36
 * Revision 1.2  1995/12/18  13:11:18  wfs
37
 * Put hppatrans uder cvs control. Major Changes made since last release
38
 * include:
39
 * (i) PIC code generation.
40
 * (ii) Profiling.
41
 * (iii) Dynamic Initialization.
42
 * (iv) Debugging of Exception Handling and Diagnostics.
43
 *
44
 * Revision 5.0  1995/08/25  13:42:58  wfs
45
 * Preperation for August 25 Glue release
46
 *
47
 * Revision 3.4  1995/08/25  11:12:16  wfs
48
 * *** empty log message ***
49
 *
50
 * Revision 3.4  1995/08/25  11:12:16  wfs
51
 * *** empty log message ***
52
 *
53
 * Revision 3.1  95/04/10  16:26:24  16:26:24  wfs (William Simmonds)
54
 * Apr95 tape version.
55
 * 
56
 * Revision 3.0  95/03/30  11:17:05  11:17:05  wfs (William Simmonds)
57
 * Mar95 tape version with CRCR95_178 bug fix.
58
 * 
59
 * Revision 2.0  95/03/15  15:26:51  15:26:51  wfs (William Simmonds)
60
 * spec 3.1 changes implemented, tests outstanding.
61
 * 
62
 * Revision 1.1  95/01/11  13:38:04  13:38:04  wfs (William Simmonds)
63
 * Initial revision
64
 * 
65
*/
66
 
67
 
68
/*******************************************************************
69
                            flpttypes.h
70
 
71
  Defines types for the internal floating point representation.
72
 
73
 ******************************************************************/
74
 
75
#ifndef flpttypekey
76
#define flpttypekey 1
77
 
78
#include <limits.h>
79
 
80
#include "fbase.h"
81
 
82
 
83
 
84
#if FBASE == 10
85
 
86
/* FBASE 10 is obsolete */
87
 
88
# define MANT_SIZE 40
89
 
90
#define Fdig unsigned char
91
 
92
# define FNUM_SIZE 65		/* max size required by flt2str */
93
/* MANT_SIZE + 1(sign) + 1(point) + 2(E+sign) + log(MAX_LONG) + 1(null) */
94
 
95
#define E_MIN	(-1000000)	/* (LONG_MIN/10) doesnt work on 80386 cc 
96
				*/
97
#define E_MAX	(LONG_MAX/10)
98
 
99
/* Function status values:   */
100
# define OKAY		0
101
# define EXP2BIG	(-1)
102
# define SYNTAX		(-2)
103
# define DIVBY0		(-3)
104
 
105
/* Rounding types:   */
106
# define R2ZERO	0
107
# define R2PINF	1
108
# define R2NINF	2
109
# define R2NEAR	3
110
 
111
typedef struct _flt {
112
  Fdig  mant[MANT_SIZE];
113
				/* mantissa digit values [0-9] (NOT '0' to
114
				   '9') */
115
  /* point is between 1st and 2nd digits */
116
  int   sign;			/* -1: negative; +1: positive; 0: value is
117
				   zero */
118
  int  exp;			/* signed exponent; in range E_MIN..E_MAX 
119
				*/
120
}                   flt;	/* floating point representation */
121
 
122
 
123
#else
124
 
125
/* all installers should use this definition */
126
 
127
#ifndef MANT_SIZE
128
#define MANT_SIZE 8
129
#endif
130
 
131
	/* MANT_SIZE is the number of mantissa array elements */
132
 
133
#define Fdig unsigned short
134
#define FBITS 16
135
	/* FBITS is the number of bits in one array element */
136
 
137
#define E_MIN	(-16384)
138
#define E_MAX	(LONG_MAX/FBASE)
139
 
140
/* Function status values:   */
141
# define OKAY		0
142
# define EXP2BIG	(-1)
143
# define SYNTAX		(-2)
144
# define DIVBY0		(-3)
145
 
146
/* Rounding types:   */
147
# define R2ZERO	3
148
# define R2PINF	2
149
# define R2NINF	1
150
# define R2NEAR	0
151
 
152
typedef struct _flt {
153
  Fdig  mant[MANT_SIZE];
154
  /* point is between 1st and 2nd digits */
155
  int   sign;			/* -1: negative; +1: positive; 0: value is
156
				   zero */
157
  int  exp;			/* signed exponent; in range E_MIN..E_MAX 
158
				*/
159
}                   flt;	/* floating point representation */
160
 
161
 
162
	/* type for result of conversion of reals to ints */
163
typedef struct r2l_t {
164
	int i1; /* least significant */
165
	int i2;
166
	int i3;
167
	int i4;	/* most significant */
168
} r2l;
169
 
170
 
171
#endif
172
typedef struct flt64_t {
173
  int big;		/* more significant 32 bits */
174
  unsigned int small;	/* less significant 32 bits */
175
} flt64;
176
	/* used to convert flpt number which are integers into a
177
	   64 bit representation */
178
 
179
 
180
#endif