]> gitweb.factorcode.org Git - factor.git/blob - extra/math/continued-fractions/continued-fractions-tests.factor
6f217433b70f87ed97ac954a3d562ec063415772
[factor.git] / extra / math / continued-fractions / continued-fractions-tests.factor
1 USING: kernel math.constants math.continued-fractions tools.test ;
2
3 { V{ 2 2.0 } } [ V{ 2.5 } dup next-approx ] unit-test
4 { V{ 2 2 } } [ V{ 2.5 } dup next-approx dup next-approx ] unit-test
5
6 { 5/2 } [ V{ 2 2.1 } >ratio ] unit-test
7 { 5/2 } [ V{ 2 1.9 } >ratio ] unit-test
8 { 5/2 } [ V{ 2 2.0 } >ratio ] unit-test
9 { 5/2 } [ V{ 2 2 } >ratio ] unit-test
10
11 { 3 } [ 1 pi approx ] unit-test
12 { 22/7 } [ 0.1 pi approx ] unit-test
13 { 355/113 } [ 0.00001 pi approx ] unit-test
14
15 { 2 } [ 1 2 approx ] unit-test
16 { 2 } [ 0.1 2 approx ] unit-test
17 { 2 } [ 0.00001 2 approx ] unit-test
18
19 { 3 } [ 1 2.5 approx ] unit-test
20 { 5/2 } [ 0.1 2.5 approx ] unit-test
21 { 5/2 } [ 0.0001 2.5 approx ] unit-test