コード例 #1
0
ファイル: test_helpers.cpp プロジェクト: 0xDEC0DE8/mcsema
inline MyFloat ceil ( MyFloat const& x )
{
#if !defined(BOOST_NO_STDC_NAMESPACE)
  return MyFloat ( std::ceil(x.to_builtin()) ) ;
#else
  return MyFloat ( ::ceil(x.to_builtin()) ) ;
#endif
}
コード例 #2
0
ファイル: testmyf2.cpp プロジェクト: Brakenfaces/C201
/*********************  TestDigits   *************************************

   Allows testing of the member functions Digits and MaxDigits.

   This routine assumes that input and output functions for MyFloats
   have been written and debugged.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
void TestDigits()
{
  MyFloat X;

  cout <<"\n============ Testing Digits and MaxDigits  ==============\n\n";

  cout << "X.MaxDigits() = " << X.MaxDigits() << " \n\n";

  do
    {
    cout << "\nEnter MyFloat ==> ";
    cin >> X;
    cin.ignore(1000, '\n');         //  Discard all chars in input stream.
    cout << "\nDigits(" << X << ") = " << X.Digits() << endl;
    }
  while ( SpaceBarToContinue() );
}
コード例 #3
0
ファイル: testmyf2.cpp プロジェクト: Brakenfaces/C201
/*********************  TestRead   ***************************************

   Allows testing of the member function Read of MyFloat.

   The Write function is assumed to be correct!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
void TestRead()
{
  MyFloat X;

  cout << "\n>>>>>>>>  Testing Read function  >>>>>>>>>>>>\n";
  do
    {
    cout << "\nEnter a MyFloat ==> ";
    cin >> X;
    cin.ignore(1000, '\n');         //  Discard all chars in input stream.

    if ( X.Digits() == 0 )       //  No significant digits
      cout << "\nInput error! ";

    cout << "\nAfter read,   X = '"<< X << "'\n";

    }
  while ( SpaceBarToContinue() );
}
コード例 #4
0
ファイル: testmyf2.cpp プロジェクト: Brakenfaces/C201
/*********************  TestAssignment   *********************************

   Allows testing of the member functions "=" of MyFloat.

   This routine assumes that input and output functions for MyFloats
   have been written and debugged.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/
void TestAssignment()
{
  MyFloat X;
  char    X_Str[100];

  cout << "\n------------  Testing \"=\" for MyFloat --------------------\n";
  do
    {
    cout << "\nEnter string holding float: ";
  
	cin.getline(X_Str, 100);

    X = X_Str;  // Call MyFloat = operator

    if ( X.Digits() == 0 )       //  Error in string format
      cout << "\nFormat error! ";

    cout << "\nAfter assignment,     'X = "<< X << "'" << endl;
    }
  while ( SpaceBarToContinue() );
}
コード例 #5
0
 static double apply ( MyFloat const& n ) { return n.to_builtin() ; }