From a468544d39ef18c6e47fd59cf427a4e25fe22b7f Mon Sep 17 00:00:00 2001 From: bremner Date: Fri, 21 Apr 2006 17:39:32 +0000 Subject: cvs to svn conversion script git-svn-id: file:///export/data/bremner/svn/trunk/inetools@2344 09fa754a-f411-0410-976a-da6bfa213b30 --- float2rat.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 float2rat.c (limited to 'float2rat.c') diff --git a/float2rat.c b/float2rat.c new file mode 100644 index 0000000..1b44a96 --- /dev/null +++ b/float2rat.c @@ -0,0 +1,87 @@ +/* + * Reads a polyhedron file on stdin with rationals and outputs + * an approximation in decimal floating point + * + * David Bremner. bremner@cs.mcgill.ca + * + */ + +static char rcsid[]="$Id$"; + +#include +#include +#include +#include + +#include "float2rat.ds" + +main(argc,argv) + int argc; + char **argv; +{ + long int m,n; + int i,j; + + long atol(); + + long **N; + long **D; + + char buf[BUFSIZ]; + + CHECK_HELP; + + while ( fgets(buf,BUFSIZ,stdin) !=NULL ) + { + fputs(buf,stdout); + if (strncmp(buf,"begin",5)==0) break; + } + + + if (scanf("%ld %ld %s",&m,&n,buf)==EOF){ + fprintf(stderr,"No begin line"); + exit(1); + } + + printf("%ld %ld rational\n",m,n); + + + for (i=0;i