/home/doxygen/libascend/compiler/fractions.h

Go to the documentation of this file.
00001 /*  ASCEND modelling environment
00002     Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
00003     Copyright (C) 2006 Carnegie Mellon University
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2, or (at your option)
00008     any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 *//*
00023     by Tom Epperly
00024     8/18/89
00025     Version: $Revision: 1.5 $
00026     Version control file: $RCSfile: fractions.h,v $
00027     Date last modified: $Date: 1997/07/18 12:29:47 $
00028     Last modified by: $Author: mthomas $
00029 */
00030 
00031 #ifndef ASC_FRACTIONS_H
00032 #define ASC_FRACTIONS_H
00033 
00034 #include <utilities/ascConfig.h>
00035 
00041 #define FRACPART short
00042 
00043 #define FRACMAX SHRT_MAX
00044 
00046 struct fraction {
00047   FRACPART numerator;
00048   FRACPART denominator;
00049 };
00050 
00051 ASC_DLLSPEC struct fraction CreateFraction(short n, short d);
00057 extern struct fraction Simplify(struct fraction f);
00063 #define Numerator(f) ((f).numerator)
00064 
00068 #define Denominator(f) ((f).denominator)
00069 
00073 extern struct fraction AddF(struct fraction f1, struct fraction f2);
00078 extern struct fraction SubF(struct fraction f1, struct fraction f2);
00083 extern struct fraction MultF(struct fraction f1, struct fraction f2);
00088 extern struct fraction DivF(struct fraction f1, struct fraction f2);
00093 extern int CmpF(struct fraction f1, struct fraction f2);
00098 extern struct fraction NegateF(struct fraction f);
00103 /* @} */
00104 
00105 #endif /* ASC_FRACTIONS_H */
00106 

Generated on Thu Jul 17 04:00:10 2008 for libascend by  doxygen 1.5.1