Math: maxf and minf functions

This commit is contained in:
Randy Mackay 2015-08-19 15:12:03 +09:00
parent 629a5fd714
commit 46c652e42f
2 changed files with 11 additions and 0 deletions

View File

@ -117,3 +117,12 @@ float pythagorous2(float a, float b) {
float pythagorous3(float a, float b, float c) { float pythagorous3(float a, float b, float c) {
return sqrtf(sq(a)+sq(b)+sq(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);
}

View File

@ -193,6 +193,8 @@ float pythagorous3(float a, float b, float c);
#define max(a,b) ((a)>(b)?(a):(b)) #define max(a,b) ((a)>(b)?(a):(b))
#define min(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 #endif // AP_MATH_H