Task

Calculate the value of   e.



(e   is also known as   Euler's number   and   Napier's constant.)



See details: Calculating the value of e

void setup() {
  double e = 0;
  long factorial = 1;
  for (int i = 0; i < 11; i++) {
    e += (double) (2 * i + 1) / factorial;
    factorial *= (2 * i + 1) * (2 * i + 2);
  }
  println("After 11 iterations");
  println("Computed value: " + e);
  println("Real value: " + Math.E);
  println("Error: " + (e - Math.E));
}