Metallic ratios: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: made the output more aligned and consistent.) |
m (→{{header|zkl}}: tweak) |
||
Line 324: | Line 324: | ||
m1,m2 := BI(bige).mul(b)/a, BI(bige).mul(c)/b; |
m1,m2 := BI(bige).mul(b)/a, BI(bige).mul(c)/b; |
||
a,b = b,c; |
a,b = b,c; |
||
if((m1 - m2).abs() < 10) return(m1,lucasSeq.idx); // idx ignores push(), ie first 2 terms |
if((m1 - m2).abs() < 10) return(m1.div(10),lucasSeq.idx); // idx ignores push(), ie first 2 terms |
||
} |
} |
||
}</lang> |
}</lang> |
||
Line 334: | Line 334: | ||
mr = mr.toString(); |
mr = mr.toString(); |
||
println("Approximated value: %s.%s - Reached after ~%d iterations." |
println("Approximated value: %s.%s - Reached after ~%d iterations." |
||
.fmt(mr[0],mr |
.fmt(mr[0],mr.del(0),i)); |
||
}</lang> |
}</lang> |
||
{{out}} |
{{out}} |