Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
Diff: math_ops.cpp
- Revision:
- 20:bf9ea5125d52
- Child:
- 25:f5741040c4bb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/math_ops.cpp Thu Mar 02 15:31:23 2017 +0000
@@ -0,0 +1,27 @@
+
+#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;
+ }
+ }