File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -20,17 +20,27 @@ inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
2020namespace 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*/
2837template <class Real >
2938Real 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 */
You can’t perform that action at this time.
0 commit comments