Crate hmath Copy item path Source utils determinant_hack impl_from_for_ref impl_trait_for_general impl_trivial_try_from impl_tryfrom_for_ref BigInt Matrix It’s very naively implemented, thus very slow. Polynomial [3, 4, 5] -> 3x^2 + 4x + 5 Ratio UBigInt ConversionError MatrixError cbrt_iter It returns cbrt(x)
. It gets more accurate as iter
gets bigger. common_denom a = v1 / v3, b = v2 / v3 where the return value is (v1, v2, v3)
cos_iter It returns cos(x)
. It gets more accurate as iter
gets bigger. cubic_2_points f(a) = v1, f(b) = v2, f’(a) = v3, f’(b) = v4
It ignores v2
and v4
if a == b
. e_const pre-calculated value of e. It’s equal to e_iter(15)
. e_iter It returns an approximate value of E.
It gets more and more accurate as k
gets bigger. exp_iter It returns e^x
. It gets more accurate as iter
gets bigger. from_points p
: Vec<(x, y)>
where f(x) = y
from_points_generic p
: Vec<(x, y)>
where f(x) = y
gcd_bi gcd_ubi inspect_ieee754_f32 You may find this function useful when you’re dealing with ieee 754 numbers .
This function returns (neg, exp, frac)
, which means n
is (-1)^(neg) * 2^(exp) * (1 + frac/2^23)
regardless of denormalization.
It returns (false, i32::MIN, 0) when n is 0. inspect_ieee754_f64 You may find this function useful when you’re dealing with ieee 754 numbers .
This function returns (neg, exp, frac)
, which means n
is (-1)^(neg) * 2^(exp) * (1 + frac/2^52)
regardless of denormalization.
It returns (false, i32::MIN, 0) when n is 0. linear_2_points f(a) = v1, f(b) = v2
If a == b
, it returns a const function. ln2_const pre-calculated value of ln2. It’s equal to ln2_iter(11)
. ln2_iter It returns an approximate value of ln(2).
It gets more and more accurate as k
gets bigger.
For now, k
should be less than 200. ln_iter It returns ln(x)
. It gets more accurate as iter
gets bigger. It panics when x
is less than 0. log_iter It returns log(x) with base base
. It gets more accurate as iter
gets bigger. It panics when x
or base
is less than or equal 0. pi_const pre-calculated value of pi. It’s equal to pi_iter(7)
. pi_iter It returns an approximate value of PI.
It gets more and more accurate as k
gets bigger.
For now, k
should be less than 255. pow_iter It returns a^b
. It gets more accurate as iter
gets bigger. If b
is an integer, try Ratio::pow_i32
instead. It panics when a
is less than 0. 0^0
is 0. quadratic_3_points f(a) = v1, f(b) = v2, f(c) = v3
If the input has inconsistent values (eg. f(3) = 4, f(3) = 5), it ignores an arbitrary one. sin_iter It returns sin(x)
. It gets more accurate as iter
gets bigger. sqrt_iter It returns sqrt(abs(x))
. It gets more accurate as iter
gets bigger. tan_iter It returns tan(x)
. It gets more accurate as iter
gets bigger.