round() function with Visual Studio 2015

Mar 8, 2016 at 10:27am
Hi,

I just upgrated from Visual Studio 2010 to 2015 version.
When I compile my code (the one that works absolutely fine with 2010 version) I got an error everytime I've used round() function. This error never ever come up when using the 2010 version.

I tried to find an answer searching about that on internet but I still haven't sort this out.

Has anyone find a similar problem?

Thanks in advance,

B.
Last edited on Mar 8, 2016 at 10:27am
Mar 8, 2016 at 10:42am
What is the error?
Mar 8, 2016 at 1:56pm
#include <cmath> ?
std::round() ?
http://en.cppreference.com/w/cpp/numeric/math/round

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23026 for x86

#include <iostream>
#include <cmath>

int main()
{
    const double value = 123.49999999 ;
    const double delta = 0.00000001 ;
    
    std::cout << std::fixed 
              << std::round(value) << ' ' << std::round(value+delta) << '\n' // 123.000000 124.000000
              << std::lround(value) << ' ' << std::llround(value+delta) << '\n' ; // 123 124
}

http://rextester.com/QZBOB83727
Topic archived. No new replies allowed.