1
1
#ifndef PGTYPES_NUMERIC
2
2
#define PGTYPES_NUMERIC
3
3
4
+ #define NUMERIC_POS 0x0000
5
+ #define NUMERIC_NEG 0x4000
6
+ #define NUMERIC_MAX_PRECISION 1000
7
+ #define NUMERIC_MAX_DISPLAY_SCALE NUMERIC_MAX_PRECISION
8
+ #define NUMERIC_MIN_DISPLAY_SCALE 0
9
+ #define NUMERIC_MIN_SIG_DIGITS 16
10
+
4
11
typedef unsigned char NumericDigit ;
5
- typedef struct NumericVar
12
+ typedef struct
6
13
{
7
14
int ndigits ; /* number of digits in digits[] - can be 0! */
8
15
int weight ; /* weight of first digit */
@@ -11,23 +18,23 @@ typedef struct NumericVar
11
18
int sign ; /* NUMERIC_POS, NUMERIC_NEG, or NUMERIC_NAN */
12
19
NumericDigit * buf ; /* start of alloc'd space for digits[] */
13
20
NumericDigit * digits ; /* decimal digits */
14
- } NumericVar ;
21
+ } Numeric ;
15
22
16
- NumericVar * PGTYPESnew (void );
17
- void PGTYPESnumeric_free (NumericVar * );
18
- NumericVar * PGTYPESnumeric_aton (char * , char * * );
19
- char * PGTYPESnumeric_ntoa (NumericVar * );
20
- int PGTYPESnumeric_add (NumericVar * , NumericVar * , NumericVar * );
21
- int PGTYPESnumeric_sub (NumericVar * , NumericVar * , NumericVar * );
22
- int PGTYPESnumeric_mul (NumericVar * , NumericVar * , NumericVar * );
23
- int PGTYPESnumeric_div (NumericVar * , NumericVar * , NumericVar * );
24
- int PGTYPESnumeric_cmp (NumericVar * , NumericVar * );
25
- int PGTYPESnumeric_iton (signed int , NumericVar * );
26
- int PGTYPESnumeric_lton (signed long int , NumericVar * );
27
- int PGTYPESnumeric_copy (NumericVar * , NumericVar * );
28
- int PGTYPESnumeric_dton (double , NumericVar * );
29
- int PGTYPESnumeric_ntod (NumericVar * , double * );
30
- int PGTYPESnumeric_ntoi (NumericVar * , int * );
31
- int PGTYPESnumeric_ntol (NumericVar * , long * );
23
+ Numeric * PGTYPESnew (void );
24
+ void PGTYPESnumeric_free (Numeric * );
25
+ Numeric * PGTYPESnumeric_aton (char * , char * * );
26
+ char * PGTYPESnumeric_ntoa (Numeric * );
27
+ int PGTYPESnumeric_add (Numeric * , Numeric * , Numeric * );
28
+ int PGTYPESnumeric_sub (Numeric * , Numeric * , Numeric * );
29
+ int PGTYPESnumeric_mul (Numeric * , Numeric * , Numeric * );
30
+ int PGTYPESnumeric_div (Numeric * , Numeric * , Numeric * );
31
+ int PGTYPESnumeric_cmp (Numeric * , Numeric * );
32
+ int PGTYPESnumeric_iton (signed int , Numeric * );
33
+ int PGTYPESnumeric_lton (signed long int , Numeric * );
34
+ int PGTYPESnumeric_copy (Numeric * , Numeric * );
35
+ int PGTYPESnumeric_dton (double , Numeric * );
36
+ int PGTYPESnumeric_ntod (Numeric * , double * );
37
+ int PGTYPESnumeric_ntoi (Numeric * , int * );
38
+ int PGTYPESnumeric_ntol (Numeric * , long * );
32
39
33
40
#endif /* PGTYPES_NUMERIC */
0 commit comments