Engel expansion: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: js version of mpfr_ceil() improved, so undid the lopping of 10 digits from pi.) |
m (→{{header|Phix}}: changed dp from 180 to 134 (min rqd)) |
||
Line 98: | Line 98: | ||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span> |
||
<span style="color: #008080;">include</span> <span style="color: #004080;">mpfr</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> |
<span style="color: #008080;">include</span> <span style="color: #004080;">mpfr</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span> |
||
<span style="color: #7060A8;">mpfr_set_default_precision</span><span style="color: #0000FF;">(-</span><span style="color: #000000;"> |
<span style="color: #7060A8;">mpfr_set_default_precision</span><span style="color: #0000FF;">(-</span><span style="color: #000000;">134</span><span style="color: #0000FF;">)</span> <span style="color: #000080;font-style:italic;">-- see notes</span> |
||
<span style="color: #008080;">function</span> <span style="color: #000000;">toEngel</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">x</span><span style="color: #0000FF;">)</span> |
<span style="color: #008080;">function</span> <span style="color: #000000;">toEngel</span><span style="color: #0000FF;">(</span><span style="color: #004080;">string</span> <span style="color: #000000;">x</span><span style="color: #0000FF;">)</span> |
||
Line 155: | Line 155: | ||
{{out}} |
{{out}} |
||
I could only get pi accurate to 125 decimal places and root2 to 87, so cut the input strings accordingly.<br> |
I could only get pi accurate to 125 decimal places and root2 to 87, so cut the input strings accordingly.<br> |
||
In fact the 1 digit error on desktop/Phix (below) don't happen in a browser |
In fact the 1 digit error on desktop/Phix (below) don't happen in a browser. <br> |
||
Increasing the precision helps but only up to a (relatively small) point, ie that 134 ''is'' needed, nowt greater helps at all. <br> |
|||
You may or may not have better luck with completely rewriting this to use mpq (rationals). |
You may or may not have better luck with completely rewriting this to use mpq (rationals). |
||
<pre> |
<pre> |