Engel expansion: Difference between revisions
m
→{{header|Phix}}: js version of mpfr_ceil() improved, so undid the lopping of 10 digits from pi.
m (→{{header|Phix}}: js version of mpfr_ceil() improved, so undid the lopping of 10 digits from pi.) |
|||
Line 130:
<span style="color: #008080;">constant</span> <span style="color: #000000;">rats</span> <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">{</span>
<span style="color: #008000;">"3.14159265358979"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"2.71828182845904"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"1.414213562373095"</span><span style="color: #0000FF;">,</span> <span style="color: #008000;">"7.59375"</span><span style="color: #0000FF;">,</span>
<span style="color: #008000;">"3.
<span style="color: #008000;">"2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642743"</span><span style="color: #0000FF;">,</span>
<span style="color: #008000;">"1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387"</span><span style="color: #0000FF;">,</span>
Line 154:
<!--</lang>-->
{{out}}
I could only get pi accurate to 125 decimal places and root2 to 87, so cut the input strings accordingly
In fact the 1 digit error on desktop/Phix (below) don't happen in a browser. Increasing the precision helps but only up to a (relatively small) point. <br>
You may or may not have better luck with completely rewriting this to use mpq (rationals).
Line 179 ⟶ 178:
Back to rational: 7.59375
Rational number : 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384
Engel expansion : 1 1 1 8 8 17 19 300 1991 2492 7236 10586 34588 63403 70637 1236467 5417668 5515697 5633167 7458122 9637848 9805775 41840855 58408380 213130873
Number of terms : 70, places :
Back to rational: 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384
Rational number : 2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642743
|