Index: src/libcfa/Makefile.am
===================================================================
--- src/libcfa/Makefile.am	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/Makefile.am	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -11,6 +11,6 @@
 ## Created On       : Sun May 31 08:54:01 2015
 ## Last Modified By : Peter A. Buhr
-## Last Modified On : Wed Mar  2 22:59:23 2016
-## Update Count     : 119
+## Last Modified On : Wed Apr  6 21:10:44 2016
+## Update Count     : 123
 ###############################################################################
 
@@ -60,9 +60,9 @@
 	${CC} ${CFLAGS} -c -o $@ $<
 
-libs = stdlib iostream fstream iterator
+libs = limits stdlib iostream fstream iterator rational
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
 
-cheaders = #  expat
-cfaheaders = limits
+cheaders = # expat
+cfaheaders = # limits
 include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
 
Index: src/libcfa/Makefile.in
===================================================================
--- src/libcfa/Makefile.in	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/Makefile.in	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -83,6 +83,6 @@
 libcfa_a_AR = $(AR) $(ARFLAGS)
 libcfa_a_LIBADD =
-am__objects_1 = stdlib.$(OBJEXT) iostream.$(OBJEXT) fstream.$(OBJEXT) \
-	iterator.$(OBJEXT)
+am__objects_1 = limits.$(OBJEXT) stdlib.$(OBJEXT) iostream.$(OBJEXT) \
+	fstream.$(OBJEXT) iterator.$(OBJEXT) rational.$(OBJEXT)
 am_libcfa_a_OBJECTS = libcfa-prelude.$(OBJEXT) $(am__objects_1)
 libcfa_a_OBJECTS = $(am_libcfa_a_OBJECTS)
@@ -213,8 +213,8 @@
 MAINTAINERCLEANFILES = ${addprefix ${libdir}/,${cfalib_DATA}} \
 	${addprefix ${libdir}/,${lib_LIBRARIES}} ${includedir}/*
-libs = stdlib iostream fstream iterator
+libs = limits stdlib iostream fstream iterator rational
 libcfa_a_SOURCES = libcfa-prelude.c ${libs:=.c}
-cheaders = #  expat
-cfaheaders = limits
+cheaders = # expat
+cfaheaders = # limits
 include_HEADERS = ${cheaders:=.h} ${libs} ${cfaheaders}
 all: all-am
@@ -297,4 +297,6 @@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/iterator.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcfa-prelude.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/limits.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rational.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdlib.Po@am__quote@
 
Index: src/libcfa/fstream
===================================================================
--- src/libcfa/fstream	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/fstream	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar  2 15:08:14 2016
-// Update Count     : 78
+// Last Modified On : Tue Apr  5 22:37:12 2016
+// Update Count     : 82
 //
 
@@ -20,13 +20,20 @@
 
 enum { separateSize = 16 };
-struct ofstream { void *file; int separate; char separator[separateSize]; };
+struct ofstream {
+	void *file;
+	_Bool sepDefault;
+	_Bool sepOnOff;
+	char separator[separateSize];
+}; // ofstream
 
 _Bool sepPrt( ofstream * );
 void sepOn( ofstream * );
 void sepOff( ofstream * );
+void sepReset( ofstream * );
+void sepReset( ofstream *, _Bool );
 void sepSet( ofstream *, const char * );
 const char * sepGet( ofstream * );
-void sepDisable( ofstream * );
-void sepEnable( ofstream * );
+_Bool sepDisable( ofstream * );
+_Bool sepEnable( ofstream * );
 int fail( ofstream * );
 int flush( ofstream * );
@@ -39,5 +46,7 @@
 
 // implement context istream
-struct ifstream { void *file; };
+struct ifstream {
+	void *file;
+}; // ifstream
 
 int fail( ifstream * is );
Index: src/libcfa/fstream.c
===================================================================
--- src/libcfa/fstream.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/fstream.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Feb 29 18:41:10 2016
-// Update Count     : 162
+// Last Modified On : Wed Apr  6 17:55:27 2016
+// Update Count     : 176
 //
 
@@ -25,9 +25,11 @@
 }
 
-#define IO_MSG "I/O error "
+#define IO_MSG "I/O error: "
 
-_Bool sepPrt( ofstream * os ) { return os->separate == 1; }
-void sepOn( ofstream * os ) { if ( os->separate != 2 ) os->separate = 1; }
-void sepOff( ofstream * os ) { if ( os->separate != 2 ) os->separate = 0; }
+_Bool sepPrt( ofstream * os ) { return os->sepOnOff; }
+void sepOn( ofstream * os ) { os->sepOnOff = 1; }
+void sepOff( ofstream * os ) { os->sepOnOff = 0; }
+void sepReset( ofstream * os ) { os->sepOnOff = os->sepDefault; }
+void sepReset( ofstream * os, _Bool reset ) { os->sepDefault = reset; os->sepOnOff = os->sepDefault; }
 void sepSet( ofstream * os, const char * s ) {
 	strncpy( &(os->separator[0]), s, separateSize - 1 );
@@ -35,6 +37,16 @@
 } // sepSet
 const char * sepGet( ofstream * os ) { return &(os->separator[0]); }
-void sepDisable( ofstream *os ) { os->separate = 2; }
-void sepEnable( ofstream *os ) { os->separate = 0; }
+_Bool sepDisable( ofstream *os ) {
+	_Bool temp = os->sepDefault;
+	os->sepDefault = 0;
+	sepReset( os );
+	return temp;
+} // sepDisable
+_Bool sepEnable( ofstream *os ) {
+	_Bool temp = os->sepDefault;
+	os->sepDefault = 1;
+	sepReset( os );
+	return temp;
+} // sepEnable
 
 int fail( ofstream * os ) {
@@ -49,5 +61,6 @@
 	FILE *file = fopen( name, mode );
 	if ( file == 0 ) {									// do not change unless successful
-		perror( IO_MSG "open output" );
+		fprintf( stderr, IO_MSG "open output file \"%s\", ", name );
+		perror( 0 );
 		exit( EXIT_FAILURE );
 	} // if
@@ -94,7 +107,7 @@
 
 
-static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 0, { ' ', '\0' } };
+static ofstream soutFile = { (FILE *)(&_IO_2_1_stdout_), 1, 0, { ' ', '\0' } };
 ofstream *sout = &soutFile;
-static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 0, { ' ', '\0' } };
+static ofstream serrFile = { (FILE *)(&_IO_2_1_stderr_), 1, 0, { ' ', '\0' } };
 ofstream *serr = &serrFile;
 
@@ -114,5 +127,6 @@
 	FILE *t = fopen( name, mode );
 	if ( t == 0 ) {										// do not change unless successful
-		perror( IO_MSG "open input" );
+		fprintf( stderr, IO_MSG "open input file \"%s\", ", name );
+		perror( 0 );
 		exit( EXIT_FAILURE );
 	} // if
@@ -175,4 +189,3 @@
 // Local Variables: //
 // tab-width: 4 //
-// compile-command: "cfa fstream.c" //
 // End: //
Index: src/libcfa/iostream
===================================================================
--- src/libcfa/iostream	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/iostream	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar  2 18:05:27 2016
-// Update Count     : 85
+// Last Modified On : Tue Apr  5 22:32:37 2016
+// Update Count     : 90
 //
 
@@ -23,8 +23,10 @@
 	void sepOn( ostype * );
 	void sepOff( ostype * );
+	void sepReset( ostype * );
+	void sepReset( ostype *, _Bool );
 	void sepSet( ostype *, const char * );
 	const char * sepGet( ostype * );
-	void sepDisable( ostype * );
-	void sepEnable( ostype * );
+	_Bool sepDisable( ostype * );
+	_Bool sepEnable( ostype * );
 	int fail( ostype * );
 	int flush( ostype * );
@@ -67,4 +69,6 @@
 forall( dtype ostype | ostream( ostype ) ) ostype * sepOn( ostype * );
 forall( dtype ostype | ostream( ostype ) ) ostype * sepOff( ostype * );
+forall( dtype ostype | ostream( ostype ) ) ostype * sepDisable( ostype * );
+forall( dtype ostype | ostream( ostype ) ) ostype * sepEnable( ostype * );
 
 // writes the range [begin, end) to the given stream
@@ -110,11 +114,11 @@
 forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, long double _Complex * );
 
-struct _Istream_str1 { char * s; };
-_Istream_str1 str( char * );
-forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str1 );
+struct _Istream_cstrUC { char * s; };
+_Istream_cstrUC cstr( char * );
+forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrUC );
 
-struct _Istream_str2 { char * s; int size; };
-_Istream_str2 str( char *, int size );
-forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_str2 );
+struct _Istream_cstrC { char * s; int size; };
+_Istream_cstrC cstr( char *, int size );
+forall( dtype istype | istream( istype ) ) istype * ?|?( istype *, _Istream_cstrC );
 
 #endif // __IOSTREAM_H__
Index: src/libcfa/iostream.c
===================================================================
--- src/libcfa/iostream.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/iostream.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Wed May 27 17:56:53 2015
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Mon Mar  7 13:51:23 2016
-// Update Count     : 227
+// Last Modified On : Wed Apr  6 16:13:29 2016
+// Update Count     : 278
 //
 
@@ -27,4 +27,5 @@
 ostype * ?|?( ostype *os, char c ) {
 	prtfmt( os, "%c", c );
+	sepOff( os );
 	return os;
 } // ?|?
@@ -32,5 +33,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, short int si ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%hd", si );
 	return os;
@@ -39,5 +41,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned short int usi ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%hu", usi );
 	return os;
@@ -46,5 +49,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, int i ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%d", i );
 	return os;
@@ -53,5 +57,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned int ui ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%u", ui );
 	return os;
@@ -60,5 +65,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long int li ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%ld", li );
 	return os;
@@ -67,5 +73,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned long int uli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%lu", uli );
 	return os;
@@ -74,5 +81,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long long int lli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%lld", lli );
 	return os;
@@ -81,5 +89,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, unsigned long long int ulli ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%llu", ulli );
 	return os;
@@ -88,5 +97,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, float f ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%g", f );
 	return os;
@@ -95,5 +105,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, double d ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%.*lg", DBL_DIG, d );
 	return os;
@@ -102,5 +113,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, long double ld ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%.*Lg", LDBL_DIG, ld );
 	return os;
@@ -110,6 +122,8 @@
 ostype * ?|?( ostype *os, float _Complex fc ) {
 	os | crealf( fc );
-	if ( cimagf( fc ) >= 0 ) os | '+';
-	os | "" | cimagf( fc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimagf( fc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimagf( fc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -118,6 +132,8 @@
 ostype * ?|?( ostype *os, double _Complex dc ) {
 	os | creal( dc );
-	if ( cimag( dc ) >= 0 ) os | '+';
-	os | "" | cimag( dc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimag( dc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimag( dc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -126,6 +142,8 @@
 ostype * ?|?( ostype *os, long double _Complex ldc ) {
 	os | creall( ldc );
-	if ( cimagl( ldc ) >= 0 ) os | '+';
-	os | "" | cimagl( ldc ) | 'i';
+	_Bool temp = sepDisable( os );						// disable separators within complex value
+	if ( cimagl( ldc ) >= 0 ) os | '+';					// negative value prints '-'
+	os | cimagl( ldc ) | 'i';
+	sepReset( os, temp );								// reset separator
 	return os;
 } // ?|?
@@ -134,14 +152,15 @@
 ostype * ?|?( ostype *os, const char *cp ) {
 	enum { Open = 1, Close, OpenClose };
-	static const char mask[256] = {
+	static const unsigned char mask[256] = {
 		// opening delimiters
 		['('] : Open, ['['] : Open, ['{'] : Open,
-		['$'] : Open, [L'£'] : Open, [L'¥'] : Open, [L'¢'] : Open, [L'¿'] : Open, [L'«'] : Open,
+		['$'] : Open, [(unsigned char)'£'] : Open, [(unsigned char)'¥'] : Open, [(unsigned char)'¿'] : Open, [(unsigned char)'«'] : Open,
 		// closing delimiters
 		[','] : Close, ['.'] : Close, [':'] : Close, [';'] : Close, ['!'] : Close, ['?'] : Close,
 		[')'] : Close, [']'] : Close, ['}'] : Close,
-		['%'] : Close, [L'»'] : Close,
+		['%'] : Close, [(unsigned char)'¢'] : Close, [(unsigned char)'»'] : Close,
 		// opening-closing delimiters
 		['\''] : OpenClose, ['`'] : OpenClose, ['"'] : OpenClose,
+		['\f'] : OpenClose, ['\n'] : OpenClose, ['\r'] : OpenClose, ['\t'] : OpenClose, ['\v'] : OpenClose, // isspace
 	}; // mask
 
@@ -149,11 +168,13 @@
 	// null string => no separator
   if ( len == 0 ) { sepOff( os ); return os; }
-	// first character NOT spacing or closing punctuation => add left separator
-	if ( sepPrt( os ) && isspace( cp[0] ) == 0 && mask[ cp[0] ] != Close && mask[ cp[0] ] != OpenClose ) {
+	// first character IS NOT spacing or closing punctuation => add left separator
+	unsigned char ch = cp[0];							// must make unsigned
+	if ( sepPrt( os ) && mask[ ch ] != Close && mask[ ch ] != OpenClose ) {
 		prtfmt( os, "%s", sepGet( os ) );
 	} // if
 	// last character IS spacing or opening punctuation => turn off separator for next item
 	unsigned int posn = len - 1;
-	if ( isspace( cp[posn] ) || mask[ cp[posn] ] == Open || mask[ cp[posn] ] == OpenClose ) {
+	ch = cp[posn];										// must make unsigned
+	if ( mask[ ch ] == Open || mask[ ch ] == OpenClose ) {
 		sepOff( os );
 	} else {
@@ -165,5 +186,6 @@
 forall( dtype ostype | ostream( ostype ) )
 ostype * ?|?( ostype *os, const void *p ) {
-	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) ); else sepOn( os );
+	if ( sepPrt( os ) ) prtfmt( os, "%s", sepGet( os ) );
+	sepReset( os );
 	prtfmt( os, "%p", p );
 	return os;
@@ -196,4 +218,16 @@
 } // sepOff
 
+forall( dtype ostype | ostream( ostype ) ) 
+ostype * sepEnable( ostype * os ) {
+	sepEnable( os );
+	return os;
+} // sepEnable
+
+forall( dtype ostype | ostream( ostype ) ) 
+ostype * sepDisable( ostype * os ) {
+	sepDisable( os );
+	return os;
+} // sepDisable
+
 //---------------------------------------
 
@@ -310,19 +344,19 @@
 } // ?|?
 
-_Istream_str1 str( char * s ) { _Istream_str1 s = { s }; return s; }
-forall( dtype istype | istream( istype ) )
-istype * ?|?( istype * is, _Istream_str1 str ) {
-	scanfmt( is, "%s", str.s );
-	return is;
-} // str
-
-_Istream_str2 str( char * s, int size ) { _Istream_str2 s = { s, size }; return s; }
-forall( dtype istype | istream( istype ) )
-istype * ?|?( istype * is, _Istream_str2 str ) {
+_Istream_cstrUC cstr( char * s ) { _Istream_cstrUC s = { s }; return s; }
+forall( dtype istype | istream( istype ) )
+istype * ?|?( istype * is, _Istream_cstrUC cstr ) {
+	scanfmt( is, "%s", cstr.s );
+	return is;
+} // cstr
+
+_Istream_cstrC cstr( char * s, int size ) { _Istream_cstrC s = { s, size }; return s; }
+forall( dtype istype | istream( istype ) )
+istype * ?|?( istype * is, _Istream_cstrC cstr ) {
 	char buf[16];
-	sprintf( buf, "%%%ds", str.size );
-	scanfmt( is, buf, str.s );
-	return is;
-} // str
+	sprintf( buf, "%%%ds", cstr.size );
+	scanfmt( is, buf, cstr.s );
+	return is;
+} // cstr
 
 // Local Variables: //
Index: src/libcfa/limits
===================================================================
--- src/libcfa/limits	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/limits	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -1,92 +1,112 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// limits -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 18:06:52 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:08:16 2016
+// Update Count     : 6
+// 
+
 // Integral Constants
 
-const short int MIN = -32768;
-const int MIN = -2147483648;
-const long int MIN = -9223372036854775807L - 1L;
-const long long int MIN = -9223372036854775807LL - 1LL;
+extern const short int MIN;
+extern const int MIN;
+extern const long int MIN;
+extern const long long int MIN;
 
-const short int MAX = 32767;
-const unsigned short int MAX = 65535;
-const int MAX = 2147483647;
-const unsigned int MAX = 4294967295_U;
-const long int MAX = 9223372036854775807_L;
-const unsigned long int MAX = 4294967295_U;
-const long long int MAX = 9223372036854775807_LL;
-const unsigned long long int MAX = 18446744073709551615_ULL;
+extern const short int MAX;
+extern const unsigned short int MAX;
+extern const int MAX;
+extern const unsigned int MAX;
+extern const long int MAX;
+extern const unsigned long int MAX;
+extern const long long int MAX;
+extern const unsigned long long int MAX;
 
 // Floating-Point Constants
 
-const float PI = 3.141592_F;				// pi
-const float PI_2 = 1.570796_F;				// pi / 2
-const float PI_4 = 0.7853981_F;				// pi / 4
-const float _1_PI = 0.3183098_F;			// 1 / pi
-const float _2_PI = 0.6366197_F;			// 2 / pi
-const float _2_SQRT_PI = 1.128379_F;			// 2 / sqrt(pi)
+extern const float PI;									// pi
+extern const float PI_2;								// pi / 2
+extern const float PI_4;								// pi / 4
+extern const float _1_PI;								// 1 / pi
+extern const float _2_PI;								// 2 / pi
+extern const float _2_SQRT_PI;							// 2 / sqrt(pi)
 
-const double PI = 3.14159265358979323846_D;		// pi
-const double PI_2 = 1.57079632679489661923_D;		// pi / 2
-const double PI_4 = 0.78539816339744830962_D;		// pi / 4
-const double _1_PI = 0.31830988618379067154_D;		// 1 / pi
-const double _2_PI = 0.63661977236758134308_D;		// 2 / pi
-const double _2_SQRT_PI = 1.12837916709551257390_D;	// 2 / sqrt(pi)
+extern const double PI;									// pi
+extern const double PI_2;								// pi / 2
+extern const double PI_4;								// pi / 4
+extern const double _1_PI;								// 1 / pi
+extern const double _2_PI;								// 2 / pi
+extern const double _2_SQRT_PI;							// 2 / sqrt(pi)
 
-const long double PI = 3.1415926535897932384626433832795029_DL; // pi
-const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
-const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
-const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
-const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
-const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
+extern const long double PI;							// pi
+extern const long double PI_2;							// pi / 2
+extern const long double PI_4;							// pi / 4
+extern const long double _1_PI;							// 1 / pi
+extern const long double _2_PI;							// 2 / pi
+extern const long double _2_SQRT_PI;					// 2 / sqrt(pi)
 
-const _Complex PI = 3.14159265358979323846_D+0.0_iD;	// pi
-const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;	// pi / 2
-const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;	// pi / 4
-const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD;	// 1 / pi
-const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD;	// 2 / pi
-const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
+extern const _Complex PI;								// pi
+extern const _Complex PI_2;								// pi / 2
+extern const _Complex PI_4;								// pi / 4
+extern const _Complex _1_PI;							// 1 / pi
+extern const _Complex _2_PI;							// 2 / pi
+extern const _Complex _2_SQRT_PI;						// 2 / sqrt(pi)
 
-const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
-const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
-const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
-const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
-const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
-const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
+extern const long _Complex PI;							// pi
+extern const long _Complex PI_2;						// pi / 2
+extern const long _Complex PI_4;						// pi / 4
+extern const long _Complex _1_PI;						// 1 / pi
+extern const long _Complex _2_PI;						// 2 / pi
+extern const long _Complex _2_SQRT_PI;					// 2 / sqrt(pi)
 
-const float E = 2.718281;				// e
-const float LOG2_E = 1.442695;				// log_2(e)
-const float LOG10_E = 0.4342944;			// log_10(e)
-const float LN_2 = 0.6931471;				// log_e(2)
-const float LN_10 = 2.302585;				// log_e(10)
-const float SQRT_2 = 1.414213;				// sqrt(2)
-const float _1_SQRT_2 = 0.7071067;			// 1 / sqrt(2)
+extern const float E;									// e
+extern const float LOG2_E;								// log_2(e)
+extern const float LOG10_E;								// log_10(e)
+extern const float LN_2;								// log_e(2)
+extern const float LN_10;								// log_e(10)
+extern const float SQRT_2;								// sqrt(2)
+extern const float _1_SQRT_2;							// 1 / sqrt(2)
 
-const double E = 2.7182818284590452354_D;		// e
-const double LOG2_E = 1.4426950408889634074_D;		// log_2(e)
-const double LOG10_E = 0.43429448190325182765_D;	// log_10(e)
-const double LN_2 = 0.69314718055994530942_D;		// log_e(2)
-const double LN_10 = 2.30258509299404568402_D;		// log_e(10)
-const double SQRT_2 = 1.41421356237309504880_D;		// sqrt(2)
-const double _1_SQRT_2 = 0.70710678118654752440_D;	// 1 / sqrt(2)
+extern const double E;									// e
+extern const double LOG2_E;								// log_2(e)
+extern const double LOG10_E;							// log_10(e)
+extern const double LN_2;								// log_e(2)
+extern const double LN_10;								// log_e(10)
+extern const double SQRT_2;								// sqrt(2)
+extern const double _1_SQRT_2;							// 1 / sqrt(2)
 
-const long double E = 2.7182818284590452353602874713526625_DL; // e
-const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
-const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
-const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
-const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
-const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
-const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
+extern const long double E;								// e
+extern const long double LOG2_E;						// log_2(e)
+extern const long double LOG10_E;						// log_10(e)
+extern const long double LN_2;							// log_e(2)
+extern const long double LN_10;							// log_e(10)
+extern const long double SQRT_2;						// sqrt(2)
+extern const long double _1_SQRT_2;						// 1/sqrt(2)
 
-const _Complex E = 2.7182818284590452354_D+0.0_iD;	// e
-const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD;	// log_2(e)
-const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
-const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;	// log_e(2)
-const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD;	// log_e(10)
-const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD;	// sqrt(2)
-const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
+extern const _Complex E;								// e
+extern const _Complex LOG2_E;							// log_2(e)
+extern const _Complex LOG10_E;							// log_10(e)
+extern const _Complex LN_2;								// log_e(2)
+extern const _Complex LN_10;							// log_e(10)
+extern const _Complex SQRT_2;							// sqrt(2)
+extern const _Complex _1_SQRT_2;						// 1 / sqrt(2)
 
-const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
-const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
-const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
-const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
-const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
-const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
-const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
+extern const long _Complex E;							// e
+extern const long _Complex LOG2_E;						// log_2(e)
+extern const long _Complex LOG10_E;						// log_10(e)
+extern const long _Complex LN_2;						// log_e(2)
+extern const long _Complex LN_10;						// log_e(10)
+extern const long _Complex SQRT_2;						// sqrt(2)
+extern const long _Complex _1_SQRT_2;					// 1 / sqrt(2)
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/limits.c
===================================================================
--- src/libcfa/limits.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/limits.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,114 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// limits.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 18:06:52 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:12:17 2016
+// Update Count     : 10
+// 
+
+#include <limits>
+
+// Integral Constants
+
+const short int MIN = -32768;
+const int MIN = -2147483648;
+const long int MIN = -9223372036854775807L - 1L;
+const long long int MIN = -9223372036854775807LL - 1LL;
+
+const short int MAX = 32767;
+const unsigned short int MAX = 65535;
+const int MAX = 2147483647;
+const unsigned int MAX = 4294967295_U;
+const long int MAX = 9223372036854775807_L;
+const unsigned long int MAX = 4294967295_U;
+const long long int MAX = 9223372036854775807_LL;
+const unsigned long long int MAX = 18446744073709551615_ULL;
+
+// Floating-Point Constants
+
+const float PI = 3.141592_F;							// pi
+const float PI_2 = 1.570796_F;							// pi / 2
+const float PI_4 = 0.7853981_F;							// pi / 4
+const float _1_PI = 0.3183098_F;						// 1 / pi
+const float _2_PI = 0.6366197_F;						// 2 / pi
+const float _2_SQRT_PI = 1.128379_F;					// 2 / sqrt(pi)
+
+const double PI = 3.14159265358979323846_D;				// pi
+const double PI_2 = 1.57079632679489661923_D;			// pi / 2
+const double PI_4 = 0.78539816339744830962_D;			// pi / 4
+const double _1_PI = 0.31830988618379067154_D;			// 1 / pi
+const double _2_PI = 0.63661977236758134308_D;			// 2 / pi
+const double _2_SQRT_PI = 1.12837916709551257390_D;		// 2 / sqrt(pi)
+
+const long double PI = 3.1415926535897932384626433832795029_DL; // pi
+const long double PI_2 = 1.5707963267948966192313216916397514_DL; // pi / 2
+const long double PI_4 = 0.7853981633974483096156608458198757_DL; // pi / 4
+const long double _1_PI = 0.3183098861837906715377675267450287_DL; // 1 / pi
+const long double _2_PI = 0.6366197723675813430755350534900574_DL; // 2 / pi
+const long double _2_SQRT_PI = 1.1283791670955125738961589031215452_DL; // 2 / sqrt(pi)
+
+const _Complex PI = 3.14159265358979323846_D+0.0_iD;	// pi
+const _Complex PI_2 = 1.57079632679489661923_D+0.0_iD;	// pi / 2
+const _Complex PI_4 = 0.78539816339744830962_D+0.0_iD;	// pi / 4
+const _Complex _1_PI = 0.31830988618379067154_D+0.0_iD;	// 1 / pi
+const _Complex _2_PI = 0.63661977236758134308_D+0.0_iD;	// 2 / pi
+const _Complex _2_SQRT_PI = 1.12837916709551257390_D+0.0_iD; // 2 / sqrt(pi)
+
+const long _Complex PI = 3.1415926535897932384626433832795029_L+0.0iL; // pi
+const long _Complex PI_2 = 1.5707963267948966192313216916397514_L+0.0iL; // pi / 2
+const long _Complex PI_4 = 0.7853981633974483096156608458198757_L+0.0iL; // pi / 4
+const long _Complex _1_PI = 0.3183098861837906715377675267450287_L+0.0iL; // 1 / pi
+const long _Complex _2_PI = 0.6366197723675813430755350534900574_L+0.0iL; // 2 / pi
+const long _Complex _2_SQRT_PI = 1.1283791670955125738961589031215452_L+0.0iL; // 2 / sqrt(pi)
+
+const float E = 2.718281;								// e
+const float LOG2_E = 1.442695;							// log_2(e)
+const float LOG10_E = 0.4342944;						// log_10(e)
+const float LN_2 = 0.6931471;							// log_e(2)
+const float LN_10 = 2.302585;							// log_e(10)
+const float SQRT_2 = 1.414213;							// sqrt(2)
+const float _1_SQRT_2 = 0.7071067;						// 1 / sqrt(2)
+
+const double E = 2.7182818284590452354_D;				// e
+const double LOG2_E = 1.4426950408889634074_D;			// log_2(e)
+const double LOG10_E = 0.43429448190325182765_D;		// log_10(e)
+const double LN_2 = 0.69314718055994530942_D;			// log_e(2)
+const double LN_10 = 2.30258509299404568402_D;			// log_e(10)
+const double SQRT_2 = 1.41421356237309504880_D;			// sqrt(2)
+const double _1_SQRT_2 = 0.70710678118654752440_D;		// 1 / sqrt(2)
+
+const long double E = 2.7182818284590452353602874713526625_DL; // e
+const long double LOG2_E = 1.4426950408889634073599246810018921_DL; // log_2(e)
+const long double LOG10_E = 0.4342944819032518276511289189166051_DL; // log_10(e)
+const long double LN_2 = 0.6931471805599453094172321214581766_DL; // log_e(2)
+const long double LN_10 = 2.3025850929940456840179914546843642_DL; // log_e(10)
+const long double SQRT_2 = 1.4142135623730950488016887242096981_DL; // sqrt(2)
+const long double _1_SQRT_2 = 0.7071067811865475244008443621048490_DL; // 1/sqrt(2)
+
+const _Complex E = 2.7182818284590452354_D+0.0_iD;		// e
+const _Complex LOG2_E = 1.4426950408889634074_D+0.0_iD;	// log_2(e)
+const _Complex LOG10_E = 0.43429448190325182765_D+0.0_iD; // log_10(e)
+const _Complex LN_2 = 0.69314718055994530942_D+0.0_iD;	// log_e(2)
+const _Complex LN_10 = 2.30258509299404568402_D+0.0_iD;	// log_e(10)
+const _Complex SQRT_2 = 1.41421356237309504880_D+0.0_iD; // sqrt(2)
+const _Complex _1_SQRT_2 = 0.70710678118654752440_D+0.0_iD; // 1 / sqrt(2)
+
+const long _Complex E = 2.7182818284590452353602874713526625_L+0.0_iL; // e
+const long _Complex LOG2_E = 1.4426950408889634073599246810018921_L+0.0_iL; // log_2(e)
+const long _Complex LOG10_E = 0.4342944819032518276511289189166051_L+0.0_iL; // log_10(e)
+const long _Complex LN_2 = 0.6931471805599453094172321214581766_L+0.0_iL; // log_e(2)
+const long _Complex LN_10 = 2.3025850929940456840179914546843642_L+0.0_iL; // log_e(10)
+const long _Complex SQRT_2 = 1.4142135623730950488016887242096981_L+0.0_iL; // sqrt(2)
+const long _Complex _1_SQRT_2 = 0.7071067811865475244008443621048490_L+0.0_iL; // 1 / sqrt(2)
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/rational
===================================================================
--- src/libcfa/rational	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/rational	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,52 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// rational -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 17:56:25 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:51:42 2016
+// Update Count     : 8
+// 
+
+#include <fstream>
+
+struct Rational {
+	long int numerator, denominator;					// invariant: denominator > 0
+}; // Rational
+
+extern struct Rational 0;
+extern struct Rational 1;
+
+long int gcd( long int a, long int b );
+long int simplify( long int *n, long int *d );
+Rational rational();									// constructor
+Rational rational( long int n );						// constructor
+Rational rational( long int n, long int d );			// constructor
+long int numerator( Rational r );
+long int numerator( Rational r, long int n );
+long int denominator( Rational r, long int d );
+int ?==?( Rational l, Rational r );
+int ?!=?( Rational l, Rational r );
+int ?<?( Rational l, Rational r );
+int ?<=?( Rational l, Rational r );
+int ?>?( Rational l, Rational r );
+int ?>=?( Rational l, Rational r );
+Rational -?( Rational r );
+Rational ?+?( Rational l, Rational r );
+Rational ?-?( Rational l, Rational r );
+Rational ?*?( Rational l, Rational r );
+Rational ?/?( Rational l, Rational r );
+double widen( Rational r );
+Rational narrow( double f, long int md );
+ifstream * ?|?( ifstream *is, Rational *r );
+ofstream * ?|?( ofstream *os, Rational r );
+
+// Local Variables: //
+// mode: c //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/rational.c
===================================================================
--- src/libcfa/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
+++ src/libcfa/rational.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -0,0 +1,205 @@
+//                               -*- Mode: C -*- 
+// 
+// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// rational.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Apr  6 17:54:28 2016
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Wed Apr  6 21:52:16 2016
+// Update Count     : 7
+// 
+
+#include "rational"
+#include <fstream>
+#include <stdlib>
+
+extern "C" {
+#include <stdlib.h>										// exit
+} // extern
+
+struct Rational 0 = {0, 1};
+struct Rational 1 = {1, 1};
+
+// Calculate the greatest common denominator of two numbers, the first of which may be negative.  It is used to reduce
+// rationals.
+
+long int gcd( long int a, long int b ) {
+    for ( ;; ) {										// Euclid's algorithm
+		long int r = a % b;
+	  if ( r == 0 ) break;
+		a = b;
+		b = r;
+    } // for
+	return b;
+} // gcd
+
+long int simplify( long int *n, long int *d ) {
+    if ( *d == 0 ) {
+		serr | "Invalid rational number construction: denominator cannot be equal to 0." | endl;
+		exit( EXIT_FAILURE );
+    } // exit
+    if ( *d < 0 ) { *d = -*d; *n = -*n; }				// move sign to numerator
+    return gcd( abs( *n ), *d );						// simplify
+} // Rationalnumber::simplify
+
+Rational rational() {									// constructor
+//    r = (Rational){ 0, 1 };
+	Rational t = { 0, 1 };
+	return t;
+} // rational
+
+Rational rational( long int n ) {						// constructor
+//    r = (Rational){ n, 1 };
+	Rational t = { n, 1 };
+	return t;
+} // rational
+
+Rational rational( long int n, long int d ) {			// constructor
+    long int t = simplify( &n, &d );					// simplify
+//    r = (Rational){ n / t, d / t };
+	Rational t = { n / t, d / t };
+	return t;
+} // rational
+
+long int numerator( Rational r ) {
+    return r.numerator;
+} // numerator
+
+long int numerator( Rational r, long int n ) {
+    long int prev = r.numerator;
+    long int t = gcd( abs( n ), r.denominator );		// simplify
+    r.numerator = n / t;
+    r.denominator = r.denominator / t;
+    return prev;
+} // numerator
+
+long int denominator( Rational r, long int d ) {
+    long int prev = r.denominator;
+    long int t = simplify( &r.numerator, &d );			// simplify
+    r.numerator = r.numerator / t;
+    r.denominator = d / t;
+    return prev;
+} // denominator
+
+int ?==?( Rational l, Rational r ) {
+    return l.numerator * r.denominator == l.denominator * r.numerator;
+} // ?==?
+
+int ?!=?( Rational l, Rational r ) {
+    return ! ( l == r );
+} // ?!=?
+
+int ?<?( Rational l, Rational r ) {
+    return l.numerator * r.denominator < l.denominator * r.numerator;
+} // ?<?
+
+int ?<=?( Rational l, Rational r ) {
+    return l < r || l == r;
+} // ?<=?
+
+int ?>?( Rational l, Rational r ) {
+    return ! ( l <= r );
+} // ?>?
+
+int ?>=?( Rational l, Rational r ) {
+    return ! ( l < r );
+} // ?>=?
+
+Rational -?( Rational r ) {
+	Rational t = { -r.numerator, r.denominator };
+    return t;
+} // -?
+
+Rational ?+?( Rational l, Rational r ) {
+    if ( l.denominator == r.denominator ) {				// special case
+		Rational t = { l.numerator + r.numerator, l.denominator };
+		return t;
+    } else {
+		Rational t = { l.numerator * r.denominator + l.denominator * r.numerator, l.denominator * r.denominator };
+		return t;
+    } // if
+} // ?+?
+
+Rational ?-?( Rational l, Rational r ) {
+    if ( l.denominator == r.denominator ) {				// special case
+		Rational t = { l.numerator - r.numerator, l.denominator };
+		return t;
+    } else {
+		Rational t = { l.numerator * r.denominator - l.denominator * r.numerator, l.denominator * r.denominator };
+		return t;
+    } // if
+} // ?-?
+
+Rational ?*?( Rational l, Rational r ) {
+    Rational t = { l.numerator * r.numerator, l.denominator * r.denominator };
+	return t;
+} // ?*?
+
+Rational ?/?( Rational l, Rational r ) {
+    if ( r.numerator < 0 ) {
+		r.numerator = -r.numerator;
+		r.denominator = -r.denominator;
+	} // if
+	Rational t = { l.numerator * r.denominator, l.denominator * r.numerator };
+    return t;
+} // ?/?
+
+double widen( Rational r ) {
+	return (double)r.numerator / (double)r.denominator;
+} // widen
+
+// https://rosettacode.org/wiki/Convert_decimal_number_to_rational#C
+Rational narrow( double f, long int md ) {
+	if ( md <= 1 ) {									// maximum fractional digits too small?
+		Rational t = rational( f, 1 );					// truncate fraction
+		return t;
+	} // if
+
+	// continued fraction coefficients
+	long int a, h[3] = { 0, 1, 0 }, k[3] = { 1, 0, 0 };
+	long int x, d, n = 1;
+	int i, neg = 0;
+ 
+	if ( f < 0 ) { neg = 1; f = -f; }
+	while ( f != floor( f ) ) { n <<= 1; f *= 2; }
+	d = f;
+ 
+	// continued fraction and check denominator each step
+	for (i = 0; i < 64; i++) {
+		a = n ? d / n : 0;
+	  if (i && !a) break;
+		x = d; d = n; n = x % n;
+		x = a;
+		if (k[1] * a + k[0] >= md) {
+			x = (md - k[0]) / k[1];
+		  if ( ! (x * 2 >= a || k[1] >= md) ) break;
+			i = 65;
+		} // if
+		h[2] = x * h[1] + h[0]; h[0] = h[1]; h[1] = h[2];
+		k[2] = x * k[1] + k[0]; k[0] = k[1]; k[1] = k[2];
+	} // for
+	Rational t = rational( neg ? -h[1] : h[1], k[1] );
+	return t;
+} // narrow
+
+ifstream * ?|?( ifstream *is, Rational *r ) {
+	long int t;
+    is | &(r->numerator) | &(r->denominator);
+	t = simplify( &(r->numerator), &(r->denominator) );
+    r->numerator /= t;
+    r->denominator /= t;
+    return is;
+} // ?|?
+
+ofstream * ?|?( ofstream *os, Rational r ) {
+    return os | r.numerator | '/' | r.denominator;
+} // ?|?
+
+// Local Variables: //
+// tab-width: 4 //
+// End: //
Index: src/libcfa/stdlib
===================================================================
--- src/libcfa/stdlib	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/stdlib	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:12:35 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Mar 22 22:34:24 2016
-// Update Count     : 69
+// Last Modified On : Fri Apr  1 22:26:14 2016
+// Update Count     : 73
 //
 
@@ -18,4 +18,5 @@
 extern "C" {
 #include <stddef.h>										// size_t
+#include <math.h>										// floor
 } // extern "C"
 
@@ -80,6 +81,6 @@
 char abs( char );
 extern "C" {
-int abs( int );		// use default C routine for int
-} // extern
+int abs( int );				// use default C routine for int
+} // extern "C"
 long int abs( long int );
 long long int abs( long long int );
@@ -90,4 +91,18 @@
 double _Complex abs( double _Complex );
 long double _Complex abs( long double _Complex );
+
+//---------------------------------------
+
+float floor( float );
+extern "C" {
+double floor( double );		// use C routine for double
+} // extern "C"
+long double floor( long double );
+
+float ceil( float );
+extern "C" {
+double ceil( double );		// use C routine for double
+} // extern "C"
+long double ceil( long double );
 
 //---------------------------------------
Index: src/libcfa/stdlib.c
===================================================================
--- src/libcfa/stdlib.c	(revision 3cfe27f396428120b21372724bf1494f2e955648)
+++ src/libcfa/stdlib.c	(revision 53ba273db2dfa4a4d251429b05f17a6400ed7f1e)
@@ -10,6 +10,6 @@
 // Created On       : Thu Jan 28 17:10:29 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Wed Mar 23 13:26:42 2016
-// Update Count     : 146
+// Last Modified On : Wed Mar 30 10:48:41 2016
+// Update Count     : 149
 //
 
@@ -243,4 +243,12 @@
 //---------------------------------------
 
+float floor( float v ) { return floorf( v ); }
+long double floor( long double v ) { return floorl( v ); }
+
+float ceil( float v ) { return ceilf( v ); }
+long double ceil( long double v ) { return ceill( v ); }
+
+//---------------------------------------
+
 void rand48seed( long int s ) { srand48( s ); }
 char rand48() { return mrand48(); }
