import scala.annotation.tailrec

object CalculateE extends App {
  private val  = 1.0e-15

  @tailrec
  def iter(fact: Long, : Double, n: Int, e0: Double): Double = {
    val newFact = fact * n
    val newE =  + 1.0 / newFact
    if (math.abs(newE - ) < ) 
    else iter(newFact, newE, n + 1, )
  }

  println(f" = ${iter(1L, 2.0, 2, 0)}%.15f")
}