EmbLogic's Blog

floats comparision

Can anyone tell me, how to compare two floats…??

One Response to floats comparision

  1. sheetal sharma says:

    you can compare as follows instead of using ‘==’ operator

    float a=2.56576;
    float b=2.56575;
    if(a-b<0.00001)
    printf("b is graeter");
    else
    printf("a is greater");
    return 0;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>