View Single Post
  #1 (permalink)  
Old June 4th, 2011, 08:53 AM
AnTiDoD AnTiDoD is offline
Registered User
Points: 17, Level: 1
Points: 17, Level: 1 Points: 17, Level: 1 Points: 17, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2011
Location: Russia
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap-3. Cycles. compiler options?

Hello! In Chapter 3 cycles with Floating Point written code:
Code:
 
for (double x = 0.0; x!= 1.0; x+= 0.2)
  cout << x;
The author says that this cycle will never end, but it is not so!

I know about the error of real numbers, but why she is not taking place? (That is if you put x != 2.0, then there will be an infinite loop)