Index: tests/math4.cfa
===================================================================
--- tests/math4.cfa	(revision ee0fa3a0f0b01f051be3b373718ecfbd98f86b29)
+++ tests/math4.cfa	(revision ee0fa3a0f0b01f051be3b373718ecfbd98f86b29)
@@ -0,0 +1,306 @@
+//
+// 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.
+//
+// math4.cfa --
+//
+// Author           : Peter A. Buhr
+// Created On       : Thu May 24 20:56:54 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Tue Aug 25 17:56:45 2020
+// Update Count     : 7
+//
+
+#include <fstream.hfa>
+#include <math.hfa>
+
+int main( void ) {
+	signed char sc, scr1, scr2, scr3;
+	unsigned char uc, ucr1, ucr2, ucr3;
+	short int si, sir1, sir2, sir3;
+	unsigned short int usi, usir1, usir2, usir3;
+	int i, ir1, ir2, ir3;
+	unsigned int ui, uir1, uir2, uir3;
+	long int li, lir1, lir2, lir3;
+	unsigned long int uli, ulir1, ulir2, ulir3;
+	long long int lli, llir1, llir2, llir3;
+	unsigned long long int ulli, ullir1, ullir2, ullir3;
+
+	float f;
+	double d;
+	long double l;
+
+	//---------------------- Nearest Integer ----------------------
+
+	//============================================================
+#if 1
+	sout | nl | "floor" | nl | nl;
+
+	printf( "signed char\n" );
+	for ( sc = 1; sc != 0; sc <<= 1 ) {
+		scr1 = floor( sc, sc ); scr2 = floor( sc + 2hh, sc ); scr3 = floor( -sc - 2hh, sc );
+		printf( "floor(%hhd, %hhd) = %hhd, floor(%hhd, %hhd) = %hhd, floor(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned char\n" );
+	for ( uc = 1; uc != 0; uc <<= 1 ) {
+		ucr1 = floor( uc, uc ); ucr2 = floor( uc + 2hh, uc ); ucr3 = floor( -uc - 2hh, uc );
+		printf( "floor(%hhu, %hhu) = %hhu, floor(%hhu, %hhu) = %hhu, floor(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "short int\n" );
+	for ( si = 1; si != 0; si <<= 1 ) {
+		sir1 = floor( si, si ); sir2 = floor( si + 2hh, si ); sir3 = floor( -si - 2hh, si );
+		printf( "floor(%hd, %hd) = %hd, floor(%hd, %hd) = %hd, floor(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned short int\n" );
+	for ( usi = 1; usi != 0; usi <<= 1 ) {
+		usir1 = floor( usi, usi ); usir2 = floor( usi + 2hh, usi ); usir3 = floor( -usi - 2hh, usi );
+		printf( "floor(%hu, %hu) = %hu, floor(%hu, %hu) = %hu, floor(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "int\n" );
+	for ( i = 1; i != 0; i <<= 1 ) {
+		ir1 = floor( i, i ); ir2 = floor( i + 2hh, i ); ir3 = floor( -i - 2hh, i );
+		printf( "floor(%d, %d) = %d, floor(%d, %d) = %d, floor(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned int\n" );
+	for ( ui = 1; ui != 0; ui <<= 1 ) {
+		uir1 = floor( ui, ui ); uir2 = floor( ui + 2hh, ui ); uir3 = floor( -ui - 2hh, ui );
+		printf( "floor(%u, %u) = %u, floor(%u, %u) = %u, floor(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long int\n" );
+	for ( li = 1; li != 0; li <<= 1 ) {
+		lir1 = floor( li, li ); lir2 = floor( li + 2hh, li ); lir3 = floor( -li - 2hh, li );
+		printf( "floor(%ld, %ld) = %ld, floor(%ld, %ld) = %ld, floor(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long int\n" );
+	for ( uli = 1; uli != 0; uli <<= 1 ) {
+		ulir1 = floor( uli, uli ); ulir2 = floor( uli + 2hh, uli ); ulir3 = floor( -uli - 2hh, uli );
+		printf( "floor(%lu, %lu) = %lu, floor(%lu, %lu) = %lu, floor(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long long int\n" );
+	for ( lli = 1; lli != 0; lli <<= 1 ) {
+		llir1 = floor( lli, lli ); llir2 = floor( lli + 2hh, lli ); llir3 = floor( -lli - 2hh, lli );
+		printf( "floor(%lld, %lld) = %lld, floor(%lld, %lld) = %lld, floor(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long long int\n" );
+	for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+		ullir1 = floor( ulli, ulli ); ullir2 = floor( ulli + 2hh, ulli ); ullir3 = floor( -ulli - 2hh, ulli );
+		printf( "floor(%llu, %llu) = %llu, floor(%llu, %llu) = %llu, floor(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
+	} // for
+	printf( "\n" );
+#endif // 0
+	//============================================================
+#if 1
+	sout | nl | "ceiling_div" | nl | nl;
+
+	printf( "signed char\n" );
+	for ( sc = 1; sc != 0; sc <<= 1 ) {
+		scr1 = ceiling_div( sc, sc ); scr2 = ceiling_div( sc + 2hh, sc ); scr3 = ceiling_div( -sc - 2hh, sc );
+		printf( "ceiling_div(%hhd, %hhd) = %hhd, ceiling_div(%hhd, %hhd) = %hhd, ceiling_div(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned char\n" );
+	for ( uc = 1; uc != 0; uc <<= 1 ) {
+		ucr1 = ceiling_div( uc, uc ); ucr2 = ceiling_div( uc + 2hh, uc ); ucr3 = ceiling_div( -uc - 2hh, uc );
+		printf( "ceiling_div(%hhu, %hhu) = %hhu, ceiling_div(%hhu, %hhu) = %hhu, ceiling_div(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "short int\n" );
+	for ( si = 1; si != 0; si <<= 1 ) {
+		sir1 = ceiling_div( si, si ); sir2 = ceiling_div( si + 2hh, si ); sir3 = ceiling_div( -si - 2hh, si );
+		printf( "ceiling_div(%hd, %hd) = %hd, ceiling_div(%hd, %hd) = %hd, ceiling_div(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned short int\n" );
+	for ( usi = 1; usi != 0; usi <<= 1 ) {
+		usir1 = ceiling_div( usi, usi ); usir2 = ceiling_div( usi + 2hh, usi ); usir3 = ceiling_div( -usi - 2hh, usi );
+		printf( "ceiling_div(%hu, %hu) = %hu, ceiling_div(%hu, %hu) = %hu, ceiling_div(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "int\n" );
+	for ( i = 1; i != 0; i <<= 1 ) {
+		ir1 = ceiling_div( i, i ); ir2 = ceiling_div( i + 2hh, i ); ir3 = ceiling_div( -i - 2hh, i );
+		printf( "ceiling_div(%d, %d) = %d, ceiling_div(%d, %d) = %d, ceiling_div(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned int\n" );
+	for ( ui = 1; ui != 0; ui <<= 1 ) {
+		uir1 = ceiling_div( ui, ui ); uir2 = ceiling_div( ui + 2hh, ui ); uir3 = ceiling_div( -ui - 2hh, ui );
+		printf( "ceiling_div(%u, %u) = %u, ceiling_div(%u, %u) = %u, ceiling_div(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long int\n" );
+	for ( li = 1; li != 0; li <<= 1 ) {
+		lir1 = ceiling_div( li, li ); lir2 = ceiling_div( li + 2hh, li ); lir3 = ceiling_div( -li - 2hh, li );
+		printf( "ceiling_div(%ld, %ld) = %ld, ceiling_div(%ld, %ld) = %ld, ceiling_div(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long int\n" );
+	for ( uli = 1; uli != 0; uli <<= 1 ) {
+		ulir1 = ceiling_div( uli, uli ); ulir2 = ceiling_div( uli + 2hh, uli ); ulir3 = ceiling_div( -uli - 2hh, uli );
+		printf( "ceiling_div(%lu, %lu) = %lu, ceiling_div(%lu, %lu) = %lu, ceiling_div(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long long int\n" );
+	for ( lli = 1; lli != 0; lli <<= 1 ) {
+		llir1 = ceiling_div( lli, lli ); llir2 = ceiling_div( lli + 2hh, lli ); llir3 = ceiling_div( -lli - 2hh, lli );
+		printf( "ceiling_div(%lld, %lld) = %lld, ceiling_div(%lld, %lld) = %lld, ceiling_div(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long long int\n" );
+	for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+		ullir1 = ceiling_div( ulli, ulli ); ullir2 = ceiling_div( ulli + 2hh, ulli ); ullir3 = ceiling_div( -ulli - 2hh, ulli );
+		printf( "ceiling_div(%llu, %llu) = %llu, ceiling_div(%llu, %llu) = %llu, ceiling_div(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
+	} // for
+	printf( "\n" );
+#endif // 0
+	//============================================================
+#if 1
+	sout | nl | "ceiling" | nl | nl;
+
+	printf( "signed char\n" );
+	for ( sc = 1; sc != 0; sc <<= 1 ) {
+		scr1 = ceiling( sc, sc ); scr2 = ceiling( sc + 2hh, sc ); scr3 = ceiling( -sc - 2hh, sc );
+		printf( "ceiling(%hhd, %hhd) = %hhd, ceiling(%hhd, %hhd) = %hhd, ceiling(%hhd, %hhd) = %hhd\n", sc, sc, scr1, sc + 2hh, sc, scr2, -sc - 2hh, sc, scr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned char\n" );
+	for ( uc = 1; uc != 0; uc <<= 1 ) {
+		ucr1 = ceiling( uc, uc ); ucr2 = ceiling( uc + 2hh, uc ); ucr3 = ceiling( -uc - 2hh, uc );
+		printf( "ceiling(%hhu, %hhu) = %hhu, ceiling(%hhu, %hhu) = %hhu, ceiling(%hhu, %hhu) = %hhu\n", uc, uc, ucr1, uc + 2uhh, uc, ucr2, -uc - 2uhh, uc, ucr3 );
+	} // for
+	printf( "\n" );
+
+	printf( "short int\n" );
+	for ( si = 1; si != 0; si <<= 1 ) {
+		sir1 = ceiling( si, si ); sir2 = ceiling( si + 2hh, si ); sir3 = ceiling( -si - 2hh, si );
+		printf( "ceiling(%hd, %hd) = %hd, ceiling(%hd, %hd) = %hd, ceiling(%hd, %hd) = %hd\n", si, si, sir1, si + 2h, si, sir2, -si - 2h, si, sir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned short int\n" );
+	for ( usi = 1; usi != 0; usi <<= 1 ) {
+		usir1 = ceiling( usi, usi ); usir2 = ceiling( usi + 2hh, usi ); usir3 = ceiling( -usi - 2hh, usi );
+		printf( "ceiling(%hu, %hu) = %hu, ceiling(%hu, %hu) = %hu, ceiling(%hu, %hu) = %hu\n", usi, usi, usir1, usi + 2uh, usi, usir2, -usi - 2uh, usi, usir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "int\n" );
+	for ( i = 1; i != 0; i <<= 1 ) {
+		ir1 = ceiling( i, i ); ir2 = ceiling( i + 2hh, i ); ir3 = ceiling( -i - 2hh, i );
+		printf( "ceiling(%d, %d) = %d, ceiling(%d, %d) = %d, ceiling(%d, %d) = %d\n", i, i, ir1, i + 2h, i, ir2, -i - 2h, i, ir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned int\n" );
+	for ( ui = 1; ui != 0; ui <<= 1 ) {
+		uir1 = ceiling( ui, ui ); uir2 = ceiling( ui + 2hh, ui ); uir3 = ceiling( -ui - 2hh, ui );
+		printf( "ceiling(%u, %u) = %u, ceiling(%u, %u) = %u, ceiling(%u, %u) = %u\n", ui, ui, uir1, ui + 2h, ui, uir2, -ui - 2h, ui, uir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long int\n" );
+	for ( li = 1; li != 0; li <<= 1 ) {
+		lir1 = ceiling( li, li ); lir2 = ceiling( li + 2hh, li ); lir3 = ceiling( -li - 2hh, li );
+		printf( "ceiling(%ld, %ld) = %ld, ceiling(%ld, %ld) = %ld, ceiling(%ld, %ld) = %ld\n", li, li, lir1, li + 2h, li, lir2, -li - 2h, li, lir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long int\n" );
+	for ( uli = 1; uli != 0; uli <<= 1 ) {
+		ulir1 = ceiling( uli, uli ); ulir2 = ceiling( uli + 2hh, uli ); ulir3 = ceiling( -uli - 2hh, uli );
+		printf( "ceiling(%lu, %lu) = %lu, ceiling(%lu, %lu) = %lu, ceiling(%lu, %lu) = %lu\n", uli, uli, ulir1, uli + 2h, uli, ulir2, -uli - 2h, uli, ulir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "long long int\n" );
+	for ( lli = 1; lli != 0; lli <<= 1 ) {
+		llir1 = ceiling( lli, lli ); llir2 = ceiling( lli + 2hh, lli ); llir3 = ceiling( -lli - 2hh, lli );
+		printf( "ceiling(%lld, %lld) = %lld, ceiling(%lld, %lld) = %lld, ceiling(%lld, %lld) = %lld\n", lli, lli, llir1, lli + 2h, lli, llir2, -lli - 2h, lli, llir3 );
+	} // for
+	printf( "\n" );
+
+	printf( "unsigned long long int\n" );
+	for ( ulli = 1; ulli != 0; ulli <<= 1 ) {
+		ullir1 = ceiling( ulli, ulli ); ullir2 = ceiling( ulli + 2hh, ulli ); ullir3 = ceiling( -ulli - 2hh, ulli );
+		printf( "ceiling(%llu, %llu) = %llu, ceiling(%llu, %llu) = %llu, ceiling(%llu, %llu) = %llu\n", ulli, ulli, ullir1, ulli + 2h, ulli, ullir2, -ulli - 2h, ulli, ullir3 );
+	} // for
+	printf( "\n" );
+#endif // 0
+
+	sout | "floor:" | floor( 1.2F ) | floor( 1.2D ) | floor( 1.2L );
+	sout | "ceil:" | ceil( 1.6F ) | ceil( 1.6D ) | ceil( 1.6L );
+	sout | "trunc:" | trunc( 3.5F ) | trunc( 3.5D ) | trunc( 3.5L );
+	sout | "rint:" | (float)rint( 1.5F ) | (double)rint( 1.5D ) | (long double)rint( 1.5L );
+	sout | "rint:" | (long int)rint( 1.5F ) | (long int)rint( 1.5D ) | (long int)rint( 1.5L );
+	sout | "rint:" | (long long int)rint( 1.5F ) | (long long int)rint( 1.5D ) | (long long int)rint( 1.5L );
+	sout | "lrint:" | lrint( 1.5F ) | lrint( 1.5D ) | lrint( 1.5L );
+	sout | "llrint:" | llrint( 1.5F ) | llrint( 1.5D ) | llrint( 1.5L );
+	sout | "nearbyint:" | nearbyint( 3.5F ) | nearbyint( 3.5D ) | nearbyint( 3.5L );
+	sout | "round:" | (float)round( 1.5F ) | (double)round( 1.5D ) | (long double)round( 1.5L );
+	sout | "round:" | (long int)round( 1.5F ) | (long int)round( 1.5D ) | (long int)round( 1.5L );
+	sout | "round:" | (long long int)round( 1.5F ) | (long long int)round( 1.5D ) | (long long int)round( 1.5L );
+	sout | "lround:" | lround( 1.5F ) | lround( 1.5D ) | lround( 1.5L );
+	sout | "llround:" | llround( 1.5F ) | llround( 1.5D ) | llround( 1.5L );
+
+	//---------------------- Manipulation ----------------------
+
+	sout | "copysign:" | copysign( 1.0F, -1.0F ) | copysign( 1.0D, -1.0D ) | copysign( 1.0L, -1.0L );
+	int exp;
+	f = frexp( 4.0F, &exp );
+	sout | "frexp:" | f | exp | nonl;
+	d = frexp( 4.0D, &exp );
+	sout | d | exp | nonl;
+	l = frexp( 4.0L, &exp );
+	sout | l | exp;
+	sout | "ldexp:" | ldexp( 2.0F, 2 ) | ldexp( 2.0D, 2 ) | ldexp( 2.0L, 2 );
+	float fi;
+	double di;
+	long double ldi;
+	f = modf( 2.3F, &fi );
+	sout | "modf:" | fi | f | nonl;
+	d = modf( 2.3D, &di );
+	sout | di | d | nonl;
+	l = modf( 2.3L, &ldi );
+	sout | ldi | l;
+	sout | "modf:" | modf( 2.3F ) | modf( 2.3D ) | modf( 2.3L );
+	sout | "nextafter:" | nextafter( 2.0F, 3.0F ) | nextafter( 2.0D, 3.0D ) | nextafter( 2.0L, 3.0L );
+	sout | "nexttoward:" | nexttoward( 2.0F, 3.0F ) | nexttoward( 2.0D, 3.0D ) | nexttoward( 2.0L, 3.0L );
+
+	sout | "scalbn:" | scalbn( 2.0F, 3 ) | scalbn( 2.0D, 3 ) | scalbn( 2.0L, 3 );
+	sout | "scalbln:" | scalbln( 2.0F, 3L ) | scalbln( 2.0D, 3L ) | scalbln( 2.0L, 3L );
+} // main
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa math4.cfa" //
+// End: //
