Opened 16 years ago

Closed 16 years ago

Last modified 15 years ago

#162 closed defect (fixed)

Replace finite function with C++ <limits> features

Reported by: mloskot Owned by: mloskot
Priority: major Milestone:
Component: Core Version: main
Severity: Significant Keywords: c99 finite math numeric_limits
Cc:

Description

In HTCoordinate.cpp:197 file finite function is used. The finite() function is obsolete also in POSIX and replaced with isfinite macro. Unfortunately, isfinite() was added in C99, so it's not available in ISO C++/2003.

Here is proposed solution that conforms to C++ standard, replace line 197:

f ( ! finite(static_cast<double>(a)) )

with following:

// Put this next to existing #include directives
#include <cmath>
#include <limits>

// replace line 197 with this line
if (std::fabs(a) > std::numeric_limits<double>::max())

Originally reported as OSX 10.5 compile problem by William Kyngesburye

Change History (6)

comment:1 by mloskot, 16 years ago

Summary: Replace finite function with C++ limitsxReplace finite function with C++ <limits> features

comment:2 by mloskot, 16 years ago

comment:3 by kyngchaos, 16 years ago

That did it. Note, there are two places where finite() is used, line 197 (getX()) and line 211 (getY()).

comment:4 by mloskot, 16 years ago

Owner: set to mloskot
Status: newassigned

comment:5 by mloskot, 16 years ago

Keywords: numeric_limits added
Resolution: fixed
Status: assignedclosed

I've just applied this fix to trunk (r2043)

comment:6 by (none), 15 years ago

Milestone: 3.0.0

Milestone 3.0.0 deleted

Note: See TracTickets for help on using tickets.