/* cddmp.h (cddlib arithmetic operations using gmp) Copyright: Komei Fukuda 2000, fukuda@ifor.math.ethz.ch Version 0.94, Aug. 4, 2005 */ /* This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __CDDMP_H #define __CDDMP_H #endif /* __CDDMP_H */ /**********************************/ /* MACROS */ /* dependent on mp implementation */ /**********************************/ #if defined GMPRATIONAL #include "gmp.h" #define dd_ARITHMETIC "GMP rational" #define dd_init(a) mpq_init(a) #define dd_clear(a) mpq_clear(a) #define dd_set(a, b) mpq_set(a,b) #define dd_set_si(a, b) ddd_mpq_set_si(a,b) /* defined in cddgmp.c */ #define dd_set_si2(a, b, c) mpq_set_si(a,b,c) /* gmp 3.1 or higher */ #define dd_add(a, b, c) mpq_add(a,b,c) #define dd_sub(a, b, c) mpq_sub(a,b,c) #define dd_mul(a, b, c) mpq_mul(a,b,c) #define dd_div(a, b, c) mpq_div(a,b,c) #define dd_neg(a, b) mpq_neg(a,b) #define dd_inv(a, b) mpq_inv(a,b) #define dd_cmp(a, b) mpq_cmp(a,b) /* returns pos if a>b, 0 if a=b, negative if ab, 0 if a=b, negative if ab, 0 if a=b, negative if a