Continued fraction/Arithmetic/Construct from rational number: Difference between revisions
Content added Content deleted
(→{{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: | Line 223: | ||
The '''numeric digits''' can be increased to a higher value to generate more terms. |
The '''numeric digits''' can be increased to a higher value to generate more terms. |
||
Two subroutines '''sqrt''' & '''pi''' were included here to demonstrate terms for √2 and π. |
<br>Two subroutines '''sqrt''' & '''pi''' were included here to demonstrate terms for √2 and π. |
||
The subroutine '''$maxfact''' was included and is only needed if the number used for '''r2cf''' is a decimal fraction. |
<br>The subroutine '''$maxfact''' was included and is only needed if the number used for '''r2cf''' is a decimal fraction. |
||
Checks were included to verify that the arguments being passed to '''r2cf''' are indeed numeric and also not zero. |
<br>Checks were included to verify that the arguments being passed to '''r2cf''' are indeed numeric and also not zero. |
||
This version handles negative numbers. |
<br>This version handles negative numbers. |
||
<lang rexx>/*REXX pgm converts decimal or rational fraction to a continued fraction*/ |
<lang rexx>/*REXX pgm converts decimal or rational fraction to a continued fraction*/ |
||
numeric digits 230 /*this determines how many terms */ |
numeric digits 230 /*this determines how many terms */ |