Crates.io | gosper |
lib.rs | gosper |
version | 0.1.0 |
source | src |
created_at | 2023-04-03 23:02:26.542168 |
updated_at | 2023-04-03 23:02:26.542168 |
description | arbitrary precision continued fraction arithmetic |
homepage | |
repository | https://github.com/themadcreator/gosper-rs |
max_upload_size | |
id | 829587 |
size | 99,137 |
This library implements several methods for arbitrary precision continued fraction arithmetic based on Bill Gosper's inspired preprint work in the 2nd appendix of the MIT HAKMEM publication[^1], where he writes:
Abstract: Contrary to everybody, [...] continued fractions are not only perfectly amenable to arithmetic, they are amenable to perfect arithmetic.
He then goes on to describe an algorithm for producing a continued fraction representing arithmetic operations (+, -, *, /) between arbitrary continued fractions.
The main benefit of this approach is that even if the operands are non-terminating continued fractions (such as representations of transcendental numbers, e.g π), consuming enough terms of the operands can bound the next term of the result to within the range of a single integer.
In this way, the terms of the result can be read off one at a time, and computation can be discontinued when the desired accuracy is attained.