Sum of a series: Difference between revisions
Content added Content deleted
(Easylang) |
Langurmonkey (talk | contribs) (added langur language example) |
||
Line 1,672: | Line 1,672: | ||
=={{header|Lang5}}== |
=={{header|Lang5}}== |
||
<syntaxhighlight lang="lang5">1000 iota 1 + 1 swap / 2 ** '+ reduce .</syntaxhighlight> |
<syntaxhighlight lang="lang5">1000 iota 1 + 1 swap / 2 ** '+ reduce .</syntaxhighlight> |
||
=={{header|langur}}== |
|||
<syntaxhighlight lang="langur">writeln "calc.: ", fold f{+}, map f 1/.x^2, 1..1000 |
|||
writeln "exact: ", pi^2/6</syntaxhighlight> |
|||
{{out}} |
|||
<pre>calc.: 1.643934566681559803139058023822206 |
|||
exact: 1.644934066848226436472415166646025 |
|||
</pre> |
|||
If we set a higher arbitrary maximum for division, we get more digits. |
|||
<syntaxhighlight lang="langur">mode divMaxScale = 100 |
|||
writeln "calc.: ", fold f{+}, map f 1/.x^2, 1..1000 |
|||
writeln "exact: ", pi^2/6</syntaxhighlight> |
|||
{{out}} |
|||
<pre>calc.: 1.6439345666815598031390580238222155896521034464936853167172372054281147052136371544864376381235947140 |
|||
exact: 1.6449340668482264364724151666460251892189499012067984377355582293700074704032008738336289006197587053 |
|||
</pre> |
|||
=={{header|Lasso}}== |
=={{header|Lasso}}== |