You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The error indicator only works naturally for nonzero coefficients. Otherwise, it will be set regardless if either power or the multiplier overflows. I can mandate a nonzero coefficient with Nonzero<T> or add an isZero check. Hm.
The isZero check should be omitted for inlined constants, so it's probably better. The Nonzero<T> approach lets you ommit checks for dynamic values, but zero is well defined so you'd want a T version regardless. I suppose it's a question of whether the optimization is worth exposing.
This is the 2nd time I've tried to remove the coefficient parameter to make the function simpler. So I'll just note that including the coefficient make little to no difference for small systems integers, but it is faster for arbitrary integes. Edit: It looks like most of the difference comes down to heap allocating the initial power and that using a static Self.one instead may make composition viable. Alternatively, a small-storage optimization would be more flexible (#44).
The initial power (
1
) in binary exponentiation is basically a coefficient.You can parameterize the initial value (#53) and get a multiplication for free:
The text was updated successfully, but these errors were encountered: