Austin Brown
/
ESCmk2_Inductance
Inductance Testing Code
Fork of CurrentModeSine by
math_ops/math_ops.cpp
- Committer:
- austinbrown124
- Date:
- 2017-05-20
- Revision:
- 0:9edd6ec0f56a
- Child:
- 1:64b881306f6f
File content as of revision 0:9edd6ec0f56a:
#include "math_ops.h" float fmaxf(float x, float y){ return (((x)>(y))?(x):(y)); } float fminf(float x, float y){ return (((x)<(y))?(x):(y)); } float fmaxf3(float x, float y, float z){ return (x > y ? (x > z ? x : z) : (y > z ? y : z)); } float fminf3(float x, float y, float z){ return (x < y ? (x < z ? x : z) : (y < z ? y : z)); } void limit_norm(float *x, float *y, float limit){ float norm = sqrt(*x * *x + *y * *y); if(norm > limit){ *x = *x * limit/norm; *y = *y * limit/norm; } }