lesson 5 precise cpp
[[lesson_5_precise_cpp]] last edit on Aug 8, 2005 4:35 AM by rescued_by_c

[user02@FC4 Lesson05]$ cat -n precise.cpp
   1  #include <iostream>
   2  using namespace std;
   3
   4  int main()
   5  {
   6     float f_not_half = 0.49999990;
   7     double d_not_half = 0.49999990;
   8
   9     cout << "Floating point 0.49999990 is " << f_not_half << endl;
  10     cout << "Double 0.49999990 is " << d_not_half << endl;
  11
  12     return 0;
  13  }
[user02@FC4 Lesson05]$ g++ -o precise precise.cpp
[user02@FC4 Lesson05]$ ./precise
Floating point 0.49999990 is 0.5
Double 0.49999990 is 0.5
[user02@FC4 Lesson05]$