123487

Dependencies:   mbed-dev-f303 FastPWM3

Revision:
34:51647c6c500d
Parent:
26:2b865c00d7e9
Child:
47:e1196a851f76
diff -r 3ab3cce8b44d -r 51647c6c500d math_ops.cpp
--- a/math_ops.cpp	Wed Aug 30 18:10:27 2017 +0000
+++ b/math_ops.cpp	Wed Nov 08 15:18:18 2017 +0000
@@ -21,6 +21,12 @@
     /// Returns minimum of x, y, z ///
     return (x < y ? (x < z ? x : z) : (y < z ? y : z));
     }
+
+float roundf(float x){
+    /// Returns nearest integer ///
+    
+    return x < 0.0f ? ceilf(x - 0.5f) : floorf(x + 0.5f);
+    }
     
 void limit_norm(float *x, float *y, float limit){
     /// Scales the lenght of vector (x, y) to be <= limit ///