# include # include # include # include # include "blas0.h" int main ( ); void dmach_test ( ); void test01 ( ); void test015 ( ); void test02 ( ); void test03 ( ); /******************************************************************************/ int main ( ) /******************************************************************************/ /* Purpose: blas0_test() tests blas0(). Licensing: This code is distributed under the MIT license. Modified: 20 March 2014 Author: John Burkardt */ { timestamp ( ); printf ( "\n" ); printf ( "BLAS0_TEST\n" ); printf ( " C version\n" ); printf ( " Test the BLAS0 library.\n" ); dmach_test ( ); test015 ( ); test03 ( ); /* Terminate. */ printf ( "\n" ); printf ( "BLAS0_TEST\n" ); printf ( " Normal end of execution.\n" ); printf ( "\n" ); timestamp ( ); return 0; } /******************************************************************************/ void dmach_test ( ) /******************************************************************************/ /* Purpose: DmACH_TEST demonstrates DMACH. Licensing: This code is distributed under the MIT license. Modified: 30 March 2007 Author: John Burkardt */ { int job; printf ( "\n" ); printf ( "DMACH_TEST\n" ); printf ( " DMACH returns some approximate machine numbers.\n" ); printf ( "\n" ); job = 1; printf ( " DMACH(1) = EPS = %e\n", dmach ( job ) ); job = 2; printf ( " DMACH(2) = TINY = %e\n", dmach ( job ) ); job = 3; printf ( " DMACH(3) = HUGE = %e\n", dmach ( job ) ); return; } /******************************************************************************/ void test015 ( ) /******************************************************************************/ /* Purpose: TEST015 tests R4_SIGN. Licensing: This code is distributed under the MIT license. Modified: 29 June 2011 Author: John Burkardt */ { # define TEST_NUM 5 int test; float x; float x_test[TEST_NUM] = { -1.25, -0.25, 0.0, +0.5, +9.0 }; printf ( "\n" ); printf ( "TEST015\n" ); printf ( " R4_SIGN returns the sign of a number.\n" ); printf ( "\n" ); for ( test = 0; test < TEST_NUM; test++ ) { x = x_test[test]; printf ( " %8f %8f\n", x, r4_sign ( x ) ); } return; # undef TEST_N } /******************************************************************************/ void test03 ( ) /******************************************************************************/ /* Purpose: TEST03 tests R8_SIGN. Licensing: This code is distributed under the MIT license. Modified: 29 June 2011 Author: John Burkardt */ { # define TEST_NUM 5 int test; double x; double x_test[TEST_NUM] = { -1.25, -0.25, 0.0, +0.5, +9.0 }; printf ( "\n" ); printf ( "TEST03\n" ); printf ( " R8_SIGN returns the sign of a number.\n" ); printf ( "\n" ); for ( test = 0; test < TEST_NUM; test++ ) { x = x_test[test]; printf ( " %8f %8f\n", x, r8_sign ( x ) ); } return; # undef TEST_NUM }