- add clippy to .build.yml to run on sr.ht
- add missing docs
- use core:: instead of std:: where possible
- use hypot() and mul_add() for better numeric stability
- make all float tests use asser_approx_eq() and explicitly check for NaN/Inf
- add missing semicolons here and there
- add #[must_use] to ensure caller uses returned value
- add const fn where appropriate
- change visibility from pub(crate) to pub (in private modules)
Signed-off-by: Stephen Waits <steve@waits.net>
Made `HeightVector` numerically safe; while `Vector` remains numerically unsafe (i.e. it can divide by 0, NaN, Inf, etc).
When HeightVector runs into a problem, it just re-randomizes itself. Since the algorithm converges relatively quickly, this seems to work fine.
Also fixed a bug so that now height will always start as a positive number (and stay that way, else get re-randomized).
Added safety to `NetworkCoordinate` which now checks that its error didn’t pull a `HeightVector` into a negative height; in which case it also re-randomizes.
Clarified the `random` construction, tweaked the DEFAULT_ERROR constant, and updated tests accordingly.
Signed-off-by: Stephen Waits <steve@waits.net>