Skip to content

Commit 6f6f252

Browse files
committed
fixed ambiguity for GCC 4.
1 parent 87ee993 commit 6f6f252

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/JAMA/tnt_math_utils.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,27 @@ inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
2020
namespace TNT
2121
{
2222
/**
23-
@returns hypotenuse of real (non-complex) scalars a and b by
23+
@returns the absolute value of a real (no-complex) scalar.
24+
*/
25+
template <class Real>
26+
Real abs(const Real &a)
27+
{
28+
return (a > 0 ? a : -a);
29+
}
30+
31+
/**
32+
@returns hypotenuse of real (non-complex) scalars a and b by
2433
avoiding underflow/overflow
2534
using (a * sqrt( 1 + (b/a) * (b/a))), rather than
2635
sqrt(a*a + b*b).
2736
*/
2837
template <class Real>
2938
Real hypot(const Real &a, const Real &b)
3039
{
31-
3240
if (a== 0)
41+
{
3342
return abs(b);
43+
}
3444
else
3545
{
3646
Real c = b/a;
@@ -55,16 +65,6 @@ Scalar max(const Scalar &a, const Scalar &b)
5565
return a > b ? a : b;
5666
}
5767
*/
58-
59-
/**
60-
@returns the absolute value of a real (no-complex) scalar.
61-
*/
62-
template <class Real>
63-
Real abs(const Real &a)
64-
{
65-
return (a > 0 ? a : -a);
66-
}
67-
6868
}
6969
#endif
7070
/* MATH_UTILS_H */

0 commit comments

Comments
 (0)