[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]$
lesson_5_precise.cpp, Rev. 1, Last changed on 2005-08-08 04:35, 298 page hits