Subversion Repositories tendra.SVN

Rev

Go to most recent revision | 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
$Author: release $
33
$Date: 1998/01/17 15:55:47 $
34
$Revision: 1.1.1.1 $
35
$Log: flpttypes.h,v $
36
 * Revision 1.1.1.1  1998/01/17  15:55:47  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.1  1995/04/06  10:44:05  currie
40
 * Initial revision
41
 *
42
***********************************************************************/
43
#ifndef flpttypekey
44
#define flpttypekey 1
45
 
46
 
47
 
48
#include <limits.h>
49
 
50
#include "fbase.h"
51
 
52
 
53
 
54
#if FBASE == 10
55
 
56
/* FBASE 10 is obsolete */
57
 
58
# define MANT_SIZE 40
59
 
60
#define Fdig unsigned char
61
 
62
# define FNUM_SIZE 65		/* max size required by flt2str */
63
/* MANT_SIZE + 1(sign) + 1(point) + 2(E+sign) + log(MAX_LONG) + 1(null) */
64
 
65
#define E_MIN	(-1000000)	/* (LONG_MIN/10) doesnt work on 80386 cc 
66
				*/
67
#define E_MAX	(LONG_MAX/10)
68
 
69
/* Function status values:   */
70
# define OKAY		0
71
# define EXP2BIG	(-1)
72
# define SYNTAX		(-2)
73
# define DIVBY0		(-3)
74
 
75
/* Rounding types:   */
76
# define R2ZERO	0
77
# define R2PINF	1
78
# define R2NINF	2
79
# define R2NEAR	3
80
 
81
typedef struct _flt {
82
  Fdig  mant[MANT_SIZE];
83
				/* mantissa digit values [0-9] (NOT '0' to
84
				   '9') */
85
  /* point is between 1st and 2nd digits */
86
  int   sign;			/* -1: negative; +1: positive; 0: value is
87
				   zero */
88
  int  exp;			/* signed exponent; in range E_MIN..E_MAX 
89
				*/
90
}                   flt;	/* floating point representation */
91
 
92
 
93
#else
94
 
95
/* all installers should use this definition */
96
 
97
#ifndef MANT_SIZE
98
#define MANT_SIZE 8
99
#endif
100
 
101
	/* MANT_SIZE is the number of mantissa array elements */
102
 
103
#define Fdig unsigned short
104
#define FBITS 16
105
	/* FBITS is the number of bits in one array element */
106
 
107
#define E_MIN	(-16384)
108
#define E_MAX	(LONG_MAX/FBASE)
109
 
110
/* Function status values:   */
111
# define OKAY		0
112
# define EXP2BIG	(-1)
113
# define SYNTAX		(-2)
114
# define DIVBY0		(-3)
115
 
116
/* Rounding types:   */
117
# define R2ZERO	3
118
# define R2PINF	2
119
# define R2NINF	1
120
# define R2NEAR	0
121
 
122
typedef struct _flt {
123
  Fdig  mant[MANT_SIZE];
124
  /* point is between 1st and 2nd digits */
125
  int   sign;			/* -1: negative; +1: positive; 0: value is
126
				   zero */
127
  int  exp;			/* signed exponent; in range E_MIN..E_MAX 
128
				*/
129
}                   flt;	/* floating point representation */
130
 
131
 
132
	/* type for result of conversion of reals to ints */
133
typedef struct r2l_t {
134
	int i1; /* least significant */
135
	int i2;
136
	int i3;
137
	int i4;	/* most significant */
138
} r2l;
139
 
140
 
141
#endif
142
typedef struct flt64_t {
143
  int big;		/* more significant 32 bits */
144
  unsigned int small;	/* less significant 32 bits */
145
} flt64;
146
	/* used to convert flpt number which are integers into a
147
	   64 bit representation */
148
 
149
 
150
#endif