turns
Fixed-point angles modulo 2π, backed by unsigned integers.
Angle<T> represents an angle as an unsigned integer where the full range of
T maps onto one full turn (2π radians / 360 degrees). Natural integer
overflow provides wraparound at 2π, so modular arithmetic is free.
Type aliases Angle8, Angle16, Angle32, Angle64, and Angle128 cover
the standard widths.
Usage
[]
= "0.1"
use Angle8;
use PI;
let pi = from_radians;
assert_eq!;
Features
std(default) — enablesnum-traits/std.libm— enablesnum-traits/libmfor transcendentals inno_stdbuilds.
For no_std:
[]
= { = "0.1", = false, = ["libm"] }
Precision
Float conversions are generic over any F: Float. Expect precision loss when
the integer width exceeds the float mantissa (e.g. Angle128 with f64 keeps
~53 of 128 bits). Non-finite inputs (NaN, infinities) are coerced to zero
rather than panicking.
License
MIT