[ANN] micromath 2.0.0-pre: approximation-based embedded arithmetic, 2D/3D vector, quaternion, and statistics library

Announcing a prerelease of the next major version of micromath: an embedded-oriented math library which trades accuracy for higher performance and lower code size:

It's designed with embedded applications in mind, providing implementations of arithmetic operations which utilize various "tricks", many of which use safe "bit twiddling" operations to perform floating-point operations much faster than an FPU can perform them (culled from either "lore" or recent academic papers). This includes a fairly complete implementation of trigonometric functions which requires no tables, making it very small compared to implementations which do use trig tables.

It started as an extraction from the accelerometer crate and as such should be very helpful for problems based on spatial rotation (e.g. IMU/AHRS).

This is the first breaking change since the initial 1.0 release in 2019. It significantly improves the implementation quality, unlocking a number of new features:

  • All approximations of arithmetic operations have been moved to a new F32 newtype wrapper which optionally impls traits from num-traits
  • Users who just want the corresponding operations to work on f32 on platforms that don't bundle their own libm-like library can still use the F32Ext trait instead.
  • 2D/3D vector types received a significant overhaul, including a new Vector trait which implements various operations in terms of fast arithmetic approximations.
  • The Quaternion type received a bit of an overhaul along with better integration with the Vector types.

Since this is a breaking change and I'd rather not do those frequently, I'm announcing this prerelease in hopes of getting some early feedback, particularly if anyone notices any showstopper issues resulting from the API changes. Otherwise I plan on shipping 2.0 soon, hopefully in the next few weeks.

Give it a try and let me know what you think!