Best way to process accelerometer data (floats, Float32Array)? #2101
Replies: 2 comments
-
Posted at 2020-10-06 by @gfwilliams Unfortunately the FPU isn't really used, no. The issue is that the JavaScript says that basically all maths should be done using Realistically you'll find that if you're using JS the execution overhead of JS is far greater than that of dealing with doubles, so your issue is what makes the most efficient use of memory (and for that, Int16Array wins). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-10-06 by Tamás @gfwilliams Thank you for the explanation. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2020-10-06 by Tamás
Hi All,
Is the FPU of the nRF52 utilised when working with 32 bit floats?
I would like to find the most efficient method to process data from the accelerometer and I'm a bit confused at the moment:
Bangle.getAccel()
returns floating point values already converted to g. It's not clear though if these should be considered asfloat
ordouble
in terms of C.Int16Array
. However, one might think that aFloat32Array
would be more straightforward and efficient to avoid conversions.I'm new to Espruino/JS and I might be confused by how C types are converted in Espruino. Could someone advise me the best approach?
Thanks,
-Tamás
Beta Was this translation helpful? Give feedback.
All reactions