This is not a bug, but limitation of 32 or 64 bit system.

When we convert some number from decimal to binary format. Some time

they don't fit exactly in 32 bits. some number may take more then 32

bits to express exact decimal number or some numbers even can't be

converted in to binary system ( called recursive Number). In these

scenario, we take the nearest binary number which can be expressed in

32 bits.Because of this we create a difference of delta.

In some cases this delta creates problem, although it looks if we add

3.2 +0.1 it should ocme 3.3 but it comes 3.3 +delta. And thats what is

happeening those cases, you mentioned here.

If you really want to see then convert them in binary format and

perfome addition of binary numbers.

G wrote:

Hi ,you guys:

look at the code below

////////////////////////////////////////////////////////////////////////////////////////////////

#include<iostream>

using namespace std;

int main()

{

double min,max,add;

while(1)

{

cout<<"Please Input The Range of C (min max): ";

cin>>min>>max;

cin.ignore(20,'\n');

cout<<"Please Input The Increment : ";

cin>>add;

for(double C=min;C <= max;C+=add)

cout<<C<<endl;

}

return 0;

}

////////////////////////////////////////////////////////////////////////////////////////////////////////

Compiler : Bloodshed Dev C++ 4.9.9.2

if I input 3.2 3.6 0.1 ,it will NOT output 3.6

but if 3.5 3.6 0.1 ,it will.

if 2.2 2.4 0.1, it will NOT output 2.4,

but if 0.2 0.4 0.1, it will output 0.4.

some other numbers would occurence like this ...

if I want to use FLOAT numbers as the condition statement, how can I

implemet it?

Thanx in advance !