-
-
Save gregtatum/048c1f389b22eac4580d to your computer and use it in GitHub Desktop.
Calculate e constant
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var e = function( iterations ) { | |
| var aggregator = 1 | |
| for( var i=1; i < iterations; i++ ) { | |
| var value=1; | |
| for( var j=2; j <= i; j++ ) { | |
| value *= 1 / j | |
| } | |
| aggregator += value | |
| } | |
| return aggregator | |
| } |
Author
gregtatum
commented
Mar 2, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment