/usr/share/axiom-20170501/src/algebra/NCNTFRAC.spad is in axiom-source 20170501-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | )abbrev package NCNTFRAC NumericContinuedFraction
++ Author: Clifton J. Williamson
++ Date Created: 12 April 1990
++ Description:
++ \spadtype{NumericContinuedFraction} provides functions
++ for converting floating point numbers to continued fractions.
NumericContinuedFraction(F) : SIG == CODE where
F : FloatingPointSystem
CFC ==> ContinuedFraction Integer
I ==> Integer
ST ==> Stream I
SIG ==> with
continuedFraction : F -> CFC
++ continuedFraction(f) converts the floating point number
++ \spad{f} to a reduced continued fraction.
CODE ==> add
cfc: F -> ST
cfc(a) == delay
aa := wholePart a
zero?(b := a - (aa :: F)) => concat(aa,empty()$ST)
concat(aa,cfc inv b)
continuedFraction a ==
aa := wholePart a
zero?(b := a - (aa :: F)) =>
reducedContinuedFraction(aa,empty()$ST)
if negative? b then (aa := aa - 1; b := b + 1)
reducedContinuedFraction(aa,cfc inv b)
|