Anonymous user
Continued fraction/Arithmetic/Construct from rational number: Difference between revisions
Continued fraction/Arithmetic/Construct from rational number (view source)
Revision as of 19:58, 10 March 2013
, 11 years ago→{{header|REXX}}: Separated the rambling paragraph to make it more readable, then sentences are disjoint enough to warrant their own paragraphs. -- ~~~~
(→{{header|Tcl}}: More tweaks) |
m (→{{header|REXX}}: Separated the rambling paragraph to make it more readable, then sentences are disjoint enough to warrant their own paragraphs. -- ~~~~) |
||
Line 223:
The '''numeric digits''' can be increased to a higher value to generate more terms.
<br>Two subroutines '''sqrt''' & '''pi''' were included here to demonstrate terms for √2 and π.
<br>The subroutine '''$maxfact''' was included and is only needed if the number used for '''r2cf''' is a decimal fraction.
<br>Checks were included to verify that the arguments being passed to '''r2cf''' are indeed numeric and also not zero.
<br>This version handles negative numbers.
<lang rexx>/*REXX pgm converts decimal or rational fraction to a continued fraction*/
numeric digits 230 /*this determines how many terms */
|