Skip to content

trunc is C++11 only #1646

Closed
springmeyer opened this Issue Dec 12, 2012 · 5 comments

3 participants

@springmeyer
Mapnik member

And we can't use the trunc from <cmath> since it is C99 only (won't work on windows)

@artemp
Mapnik member
artemp commented Dec 12, 2012

@springmeyer - we can use boost::math::trunc on windows or implement out own trunc.

@springmeyer
Mapnik member

@artemp - thanks, currently seeing compiles work with boost::math::trunc on windows, will report back if tests run okay.

@artemp
Mapnik member
artemp commented Dec 14, 2012

@springmeyer - couple issues with implementation:

  • log10 (0.0) returns -inf
  • log10 () return nan
  • boost::math::trunc throws for -inf and nan
@artemp artemp reopened this Dec 14, 2012
@springmeyer
Mapnik member

k, thanks, we should add those to the C++ tests.

@strk
strk commented Dec 17, 2012

ah, now I get why I couldn't reproduce the problem with 0 and <0, it took boost::math::trunc to do that !
It's enough to add a check for 0.0 and use abs(n) in the precision() function to fix those cases.

@PetrDlouhy PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013
@springmeyer springmeyer fix compile on windows with msvc 2010 - closes #1646 f407e47
@PetrDlouhy PetrDlouhy added a commit to PetrDlouhy/mapnik that referenced this issue Aug 22, 2013
@springmeyer springmeyer removed unused trunc and cmath headers - closes #1646 ca15ba2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.