Re: difference in calculation result when using gcc vs Visual studio and optimisation flag

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 26/04/2018 07:24, Игорь Сотниченко wrote:

> Thanks for the answer, a problem with floating point.
> I want to understand why disabling optimization solves the problem?

http://c-faq.com/fp/

See question 14.4a

Floating point numbers are approximations of real numbers.
For example, adding a "large" number to a "tiny" number "loses" the
precision of the tiny number. Addition is not associative.
Compilers are allowed to perform the computation in higher precision
than the actual type, which may affect the result.

If you have a lot of time on your hands, and a desire to learn,
you may also want to read:

https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Regards.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux