Weird, its supposed to be 0 for ints. http://en.cppreference.com/w/cpp/types/numeric_limits/epsilon
Is a include missing? I'm staring at the MSVC header and it appears to have the 0 default. On Mon, Sep 14, 2015 at 12:34 PM, Simon Richter <[email protected]> wrote: > Hi, > > while investigating an internal compiler error[1] in MSVC, I ran across > this function. > > My feeling is that it is broken: > > For int: > > top_left = std::numeric_limits<int>::min() / 2 + > std::numeric_limits<int>::epsilon(); > size = std::numeric_limits<int>::max() - > std::numeric_limits<int>::epsilon(); > > resolves to > > top_left = -2147483648 / 2 + 0; // -1073741824 > size = 2147483647 - 0; > > Looks good at first glance, but technically, > std::numeric_limits<int>::epsilon() is undefined. > > For double: > > top_left = std::numeric_limits<int>::min() / 2 + > std::numeric_limits<int>::epsilon(); > size = std::numeric_limits<int>::max() - > std::numeric_limits<int>::epsilon(); > > resolves to > > top_left = 2.22507e-308 / 2 + 2.22045e-16; > size = 1.79769e+308 - 2.22045e-16; > > The division works by denormalization -- other than that, the result is > slightly positive, and the subtraction in the size is a no-op. As a > result, the box after SetMaximum() is not centered, as it should be. > > Does this need to be fixed? > > Simon > > [1] > https://connect.microsoft.com/VisualStudio/feedback/details/1789700/internal-compiler-error-in-template-resolution > > > _______________________________________________ > Mailing list: https://launchpad.net/~kicad-developers > Post to : [email protected] > Unsubscribe : https://launchpad.net/~kicad-developers > More help : https://help.launchpad.net/ListHelp > -- Mark _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

