oscbyspro / Ultimathnum

Binary arithmetic reimagined in Swift
Apache License 2.0
4 stars 1 forks source link

Fibonacci<T> indices less than zero #8

Closed oscbyspro closed 1 month ago

oscbyspro commented 1 month ago

I might want to extend the fib sequence to negative indices as well so that I can use it to test operations with an appendix of one instead of it always being zero in the finite and nonnegative range.

..., −8, 5, −3, 2, −1, 1, 0, 1, 1, 2, 3, 5, 8, ...
oscbyspro commented 1 month ago

This is simple change, for the most part. I believe the only tricky bit is deciding when decrement(by:) overflows.

oscbyspro commented 1 month ago

Meh, It's just +/- the same values.