#include #include "Float.h" #include "num2bin.h" using namespace ca_uwaterloo_alumni_dwharder; using namespace std; int main() { cout << sizeof( long double ) << endl; Float a = 1.0023253f; Float b = 1.9998235f; Float c = 1.9998235f; cout.precision( 20 ); Float x = (a + b)*c; Float y = a*c + b*c; cout << "(a + b)*c =" << endl; cout << (a + b)*c << endl; cout << "a*c + b*c =" << endl; cout << a*c + b*c << endl << endl; cout << "a =" << endl; cout << static_cast( a ) << '\t' << num2bin( static_cast( a ) ) << endl; cout << static_cast( a ) << '\t' << num2bin( static_cast( a ) ) << endl; cout << a.lower() << '\t' << num2bin( a.lower() ) << endl; cout << a.upper() << '\t' << num2bin( a.upper() ) << endl << endl; cout << "b =" << endl; cout << static_cast( b ) << '\t' << num2bin( static_cast( b ) ) << endl; cout << static_cast( b ) << '\t' << num2bin( static_cast( b ) ) << endl; cout << b.lower() << '\t' << num2bin( b.lower() ) << endl; cout << b.upper() << '\t' << num2bin( b.upper() ) << endl << endl; cout << "c =" << endl; cout << static_cast( c ) << '\t' << num2bin( static_cast( c ) ) << endl; cout << static_cast( c ) << '\t' << num2bin( static_cast( c ) ) << endl; cout << c.lower() << '\t' << num2bin( c.lower() ) << endl; cout << c.upper() << '\t' << num2bin( c.upper() ) << endl << endl; cout << "(a + b)*c =" << endl; cout << static_cast( x ) << '\t' << num2bin( static_cast( x ) ) << endl; cout << static_cast( x ) << '\t' << num2bin( static_cast( x ) ) << endl; cout << x.lower() << '\t' << num2bin( x.lower() ) << endl; cout << x.upper() << '\t' << num2bin( x.upper() ) << endl << endl; cout << "a*c + b*c =" << endl; cout << static_cast( y ) << '\t' << num2bin( static_cast( y ) ) << endl; cout << static_cast( y ) << '\t' << num2bin( static_cast( y ) ) << endl; cout << y.lower() << '\t' << num2bin( y.lower() ) << endl; cout << y.upper() << '\t' << num2bin( y.upper() ) << endl << endl; return 0; }