Continued fraction: Difference between revisions
Content deleted Content added
Added Forth |
m →{{header|REXX}}: deleted a blank line, expanded ''output'' a wee bit. -- ~~~~ |
||
Line 548: | Line 548: | ||
/*also: [e+1] / [e-1] */ |
/*also: [e+1] / [e-1] */ |
||
exit |
exit |
||
/*────────────────────────────────$CF subroutine────────────────────────*/ |
/*────────────────────────────────$CF subroutine────────────────────────*/ |
||
$cf: procedure; parse arg c x,y; !=0; numeric digits digits()*2 |
$cf: procedure; parse arg c x,y; !=0; numeric digits digits()*2 |
||
Line 560: | Line 559: | ||
divzero: say; say '***error!***'; say 'division by zero.'; say; exit 13 |
divzero: say; say '***error!***'; say 'division by zero.'; say; exit 13 |
||
tell:parse arg _,v;say right(_,8) '=' format(v) 'a terms='left(a,40);a=;b=;return</lang> |
tell:parse arg _,v;say right(_,8) '=' format(v) 'a terms='left(a,40);a=;b=;return</lang> |
||
'''output''' |
|||
Output: |
|||
<pre style="height: |
<pre style="height:30ex;overflow:scroll"> |
||
sqrt(2) = 1.41421356237309504880168872420969807856967187537694807317668 a terms= 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 |
sqrt(2) = 1.41421356237309504880168872420969807856967187537694807317668 a terms= 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 |
||
e = 2.71828182845904523536028747135266249775724709369995957496697 a terms= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
e = 2.71828182845904523536028747135266249775724709369995957496697 a terms= 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |