Search Results - CodeGuru Forums
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Igor Vartanov

Search: Search took 0.11 seconds.

  1. Replies
    22
    Views
    6,896

    Re: 0 isn't 0 in C++ math

    Yep, see above: float calculations have finite precision. And the result might fluctuate a little. :)
  2. Replies
    22
    Views
    6,896

    Re: 0 isn't 0 in C++ math

    Well, the big mistake you make is that you think math and programming are the same. Floats in programming have finite precision, so you must take certain precautions and tricks to succeed with your...
  3. Replies
    22
    Views
    6,896

    Re: 0 isn't 0 in C++ math

    I don't know what's wrong with your code, but mine works fine:

    #include <stdio.h>

    int main()
    {
    float a = -0.1;
    printf("%f", a +0.1);
    return 0;
    }
  4. Replies
    22
    Views
    6,896

    Re: 0 isn't 0 in C++ math

    It's impossible to succeed with the condition fabsf(c - a) < 0.0. Victor meant something like fabsf(c - a) < 0.00001.
  5. Replies
    22
    Views
    6,896

    Re: 0 isn't 0 in C++ math

    Result of 1/0 is infinity, while programming languages operate with only finite figures. So you have the best result FPU was able to provide. :)
Results 1 to 5 of 5


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)