Annotation of OpenXM/src/kan96xx/Kan/rat.c, Revision 1.5
1.5 ! ohara 1: /* $OpenXM: OpenXM/src/kan96xx/Kan/rat.c,v 1.4 2005/06/16 05:07:23 takayama Exp $ */
1.1 maekawa 2:
3: /* rat.c: rational functions */
4: #include <stdio.h>
1.5 ! ohara 5: #include <stdlib.h>
1.1 maekawa 6: #include "datatype.h"
7: #include "stackm.h"
8: #include "extern.h"
9: #include "extern2.h"
10:
11: static void errorRationalFunction(char *str);
12: static void warningRationalFunction(char *str);
13:
14: struct object KnewRationalFunction0(op1,op2)
1.3 takayama 15: objectp op1;
16: objectp op2;
1.1 maekawa 17: {
1.4 takayama 18: struct object rob = OINIT;
1.1 maekawa 19: rob.tag = SrationalFunction;
20: Knumerator(rob) = op1;
21: Kdenominator(rob) = op2;
22: KisInvalidRational(&rob);
23: return(rob);
24: }
25:
26:
27: int KisZeroObject(op)
1.3 takayama 28: objectp op;
1.1 maekawa 29: {
30: switch(op->tag) {
31: case Spoly:
32: if ((op->lc.poly) ISZERO) return(1);
33: else return(0);
34: break;
35: case SuniversalNumber:
36: if (isZero( op->lc.universalNumber)) return(1);
37: else return(0);
38: break;
39: default:
40: warningRationalFunction("KisZeroObject() does not support this object.");
41: return(0);
42: }
43: }
44:
45: objectp copyObjectp(op)
1.3 takayama 46: objectp op;
1.1 maekawa 47: {
48: objectp rop;
49: rop = newObject();
50: *rop = *op;
51: return(rop);
52: }
53:
54: void errorRationalFunction(str)
1.3 takayama 55: char *str;
1.1 maekawa 56: {
57: fprintf(stderr,"Error(rat.c): %s\n",str);
58: exit(20);
59: }
60:
61: void warningRationalFunction(str)
1.3 takayama 62: char *str;
1.1 maekawa 63: {
64: fprintf(stderr,"Warning(rat.c): %s\n",str);
65: }
66:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>