Why Does My Floating Point Number 0.7 Evaluate At Less Than 0.7

Posted by swamy on Stack Overflow See other posts from Stack Overflow or by swamy
Published on 2010-06-18T13:50:05Z Indexed on 2010/06/18 14:03 UTC
Read the original article Hit count: 196

Filed under:
|
void main()
{
    float a=0.5,b=0.7;
    if(b<0.7)
    {
        if(a<0.5)
            printf("hello");
        else
            printf("world");
    }
    else
        printf("jsdf");
}

Output: world

Please give the explanation.

© Stack Overflow or respective owner

Related posts about c

    Related posts about floating-point