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.
Diff: math_ops.cpp
- Revision:
- 34:51647c6c500d
- Parent:
- 26:2b865c00d7e9
- Child:
- 47:e1196a851f76
--- 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 ///