#include #include "machar.h" int main ( void ); void test01 ( void ); void test02 ( void ); int main ( void ) { /* Purpose: MACHAR_PRB runs the MACHAR tests. */ printf ( "\n" ); printf ( "MACHAR_PRB\n" ); printf ( " Tests for the MACHAR machine\n" ); printf ( " characteristic routines.\n" ); test01 ( ); test02 ( ); printf ( "\n" ); printf ( "MACHAR_PRB\n" ); printf ( " Normal end of execution.\n" ); return 0; } void test01 ( void ) { /* Purpose: TEST01 tests MACHAR_S. */ float eps; float epsneg; long int ibeta; long int iexp; long int irnd; long int it; long int machep; long int maxexp; long int minexp; long int negep; long int ngrd; float xmax; float xmin; ! printf ( "\n" ); printf ( "TEST01\n" ); printf ( " Test MACHAR_S, which computes single\n" ); printf ( " precision machine constants.\n" ); machar_s ( &ibeta, &it, &irnd, &ngrd, &machep, &negep, &iexp, &minexp, &maxexp, &eps, &epsneg, &xmin, &xmax ); printf ( "\n" ); printf ( " IBETA = %d\n", ibeta ); printf ( " IT = %d\n", it ); printf ( " IRND = %d\n", irnd ); printf ( " NGRD = %d\n", ngrd ); printf ( " MACHEP = %d\n", machep ); printf ( " NEGEP = %d\n", negep ); printf ( " IEXP = %d\n", iexp ); printf ( " MINEXP = %d\n", minexp ); printf ( " MAXEXP = %d\n", maxexp ); printf ( " EPS = %g\n", eps ); printf ( " EPSNEG = %g\n", epsneg ); printf ( " XMIN = %g\n", xmin ); printf ( " XMAX = %g\n", xmax ); return; } void test02 ( void ) { /* Purpose: TEST02 tests MACHAR_D. */ double eps; double epsneg; long int ibeta; long int iexp; long int irnd; long int it; long int machep; long int maxexp; long int minexp; long int negep; long int ngrd; double xmax; double xmin; ! printf ( "\n" ); printf ( "TEST02\n" ); printf ( " Test MACHAR_D, which computes double\n" ); printf ( " precision machine constants.\n" ); machar_d ( &ibeta, &it, &irnd, &ngrd, &machep, &negep, &iexp, &minexp, &maxexp, &eps, &epsneg, &xmin, &xmax ); printf ( "\n" ); printf ( " IBETA = %d\n", ibeta ); printf ( " IT = %d\n", it ); printf ( " IRND = %d\n", irnd ); printf ( " NGRD = %d\n", ngrd ); printf ( " MACHEP = %d\n", machep ); printf ( " NEGEP = %d\n", negep ); printf ( " IEXP = %d\n", iexp ); printf ( " MINEXP = %d\n", minexp ); printf ( " MAXEXP = %d\n", maxexp ); printf ( " EPS = %g\n", eps ); printf ( " EPSNEG = %g\n", epsneg ); printf ( " XMIN = %g\n", xmin ); printf ( " XMAX = %g\n", xmax ); return; }