# include # include # include # include # include # include using namespace std; # include "blas0.hpp" int main ( ); void dmach_test ( ); void test01 ( ); void test015 ( ); void test02 ( ); void test03 ( ); void timestamp ( ); //****************************************************************************80 int main ( ) //****************************************************************************80 // // Purpose: // // blas0_test() tests blas0(). // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 25 March 2014 // // Author: // // John Burkardt // { timestamp ( ); cout << "\n"; cout << "BLAS0_TEST():\n"; cout << " C++ version\n"; cout << " Test BLAS0().\n"; dmach_test ( ); test015 ( ); test03 ( ); // // Terminate. // cout << "\n"; cout << "BLAS0_TEST():\n"; cout << " Normal end of execution.\n"; cout << "\n"; timestamp ( ); return 0; } //****************************************************************************80 void dmach_test ( ) //****************************************************************************80 // // Purpose: // // DMACH_TEST demonstrates DMACH. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 15 May 2006 // // Author: // // John Burkardt // { int job; cout << "\n"; cout << "DMACH_TEST\n"; cout << " DMACH returns some approximate machine numbers.\n"; cout << "\n"; job = 1; cout << " DMACH(1) = EPS = " << dmach ( job ) << "\n"; job = 2; cout << " DMACH(2) = TINY = " << dmach ( job ) << "\n"; job = 3; cout << " DMACH(3) = HUGE = " << dmach ( job ) << "\n"; return; } //****************************************************************************80 void test015 ( ) //****************************************************************************80 // // Purpose: // // TEST015 tests R4_SIGN. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 25 March 2014 // // 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 }; cout << "\n"; cout << "TEST015\n"; cout << " R4_SIGN returns the sign of a number.\n"; cout << "\n"; for ( test = 0; test < TEST_NUM; test++ ) { x = x_test[test]; cout << " " << setw(8) << x << " " << setw(8) << r4_sign ( x ) << "\n"; } return; # undef TEST_N } //****************************************************************************80 void test03 ( ) //****************************************************************************80 // // Purpose: // // TEST03 tests R8_SIGN. // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 25 March 2014 // // 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 }; cout << "\n"; cout << "TEST03\n"; cout << " R8_SIGN returns the sign of a number.\n"; cout << "\n"; for ( test = 0; test < TEST_NUM; test++ ) { x = x_test[test]; cout << " " << setw(8) << x << " " << setw(8) << r8_sign ( x ) << "\n"; } return; # undef TEST_NUM } //****************************************************************************80 void timestamp ( ) //****************************************************************************80 // // Purpose: // // timestamp() prints the current YMDHMS date as a time stamp. // // Example: // // 31 May 2001 09:45:54 AM // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 19 March 2018 // // Author: // // John Burkardt // { # define TIME_SIZE 40 static char time_buffer[TIME_SIZE]; const struct std::tm *tm_ptr; std::time_t now; now = std::time ( NULL ); tm_ptr = std::localtime ( &now ); std::strftime ( time_buffer, TIME_SIZE, "%d %B %Y %I:%M:%S %p", tm_ptr ); std::cout << time_buffer << "\n"; return; # undef TIME_SIZE }