[BACK]Return to rat.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Kan

Annotation of OpenXM/src/kan96xx/Kan/rat.c, Revision 1.4

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>