Calculating the value of e: Difference between revisions
Content added Content deleted
(Hoon) |
|||
Line 2,117: | Line 2,117: | ||
{{Out}} |
{{Out}} |
||
<pre>2.7182818284590455</pre> |
<pre>2.7182818284590455</pre> |
||
=={{header|Hoon}}== |
|||
<syntaxhighlight lang="hoon">:- %say |
|||
|= * |
|||
:- %noun |
|||
=/ i .~2 |
|||
=/ e .~1 |
|||
=/ e0 .~0 |
|||
=/ denom .~1 |
|||
|- |
|||
?: (lth:rd (sub:rd e e0) .~1e-15) |
|||
e |
|||
%= $ |
|||
i (add:rd i .~1) |
|||
e (add:rd e (div:rd .~1 denom)) |
|||
e0 e |
|||
denom (mul:rd denom i) |
|||
==</syntaxhighlight> |
|||
=={{header|Icon}} and {{header|Unicon}}== |
=={{header|Icon}} and {{header|Unicon}}== |
||