Browse Source

Math: maxf and minf functions

mission-4.1.18
Randy Mackay 10 years ago
parent
commit
46c652e42f
  1. 9
      libraries/AP_Math/AP_Math.cpp
  2. 2
      libraries/AP_Math/AP_Math.h

9
libraries/AP_Math/AP_Math.cpp

@ -117,3 +117,12 @@ float pythagorous2(float a, float b) { @@ -117,3 +117,12 @@ float pythagorous2(float a, float b) {
float pythagorous3(float a, float b, float c) {
return sqrtf(sq(a)+sq(b)+sq(c));
}
float maxf(float a, float b)
{
return (a>b?a:b);
}
float minf(float a, float b)
{
return (a<b?a:b);
}

2
libraries/AP_Math/AP_Math.h

@ -193,6 +193,8 @@ float pythagorous3(float a, float b, float c); @@ -193,6 +193,8 @@ float pythagorous3(float a, float b, float c);
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
float maxf(float a, float b);
float minf(float a, float b);
#endif // AP_MATH_H

Loading…
Cancel
Save