Annotation of OpenXM/src/kan96xx/Kan/rat.c, Revision 1.1
1.1 ! maekawa 1:
! 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)
! 14: objectp op1;
! 15: objectp op2;
! 16: {
! 17: struct object rob;
! 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)
! 27: objectp op;
! 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)
! 45: objectp op;
! 46: {
! 47: objectp rop;
! 48: rop = newObject();
! 49: *rop = *op;
! 50: return(rop);
! 51: }
! 52:
! 53: void errorRationalFunction(str)
! 54: char *str;
! 55: {
! 56: fprintf(stderr,"Error(rat.c): %s\n",str);
! 57: exit(20);
! 58: }
! 59:
! 60: void warningRationalFunction(str)
! 61: char *str;
! 62: {
! 63: fprintf(stderr,"Warning(rat.c): %s\n",str);
! 64: }
! 65:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>