1 /* number.h: Arbitrary precision numbers header file. */ 2 3 /* This file is part of bc written for MINIX. 4 Copyright (C) 1991, 1992 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License , or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; see the file COPYING. If not, write to 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 19 20 You may contact the author by: 21 e-mail: phil@cs.wwu.edu 22 us-mail: Philip A. Nelson 23 Computer Science Department, 9062 24 Western Washington University 25 Bellingham, WA 98226-9062 26 27 *************************************************************************/ 28 29 30 typedef enum {PLUS, MINUS} sign; 31 32 typedef struct 33 { 34 sign n_sign; 35 int n_len; /* The number of digits before the decimal point. */ 36 int n_scale; /* The number of digits after the decimal point. */ 37 int n_refs; /* The number of pointers to this number. */ 38 char n_value[1]; /* The storage. Not zero char terminated. It is 39 allocated with all other fields. */ 40 } bc_struct; 41 42 typedef bc_struct *bc_num; 43 44 /* Some useful macros and constants. */ 45 46 #define CH_VAL(c) (c - '0') 47 #define BCD_CHAR(d) (d + '0') 48 49 #ifdef MIN 50 #undef MIN 51 #undef MAX 52 #endif 53 #define MAX(a,b) (a>b?a:b) 54 #define MIN(a,b) (a>b?b:a) 55 #define ODD(a) (a&1) 56 57 #ifndef TRUE 58 #define TRUE 1 59 #define FALSE 0 60 #endif 61