#!/usr/bin/ruby

func pi(n) {
    var pi = 0.0;

    for ((var i = 1; var j = 0) ; j <= n ; (i += 2; j++)) {
        pi += (1/i -> (%w(neg abs)[j.is_even]));
    }

    return (pi * 4);
}

func e(n) {
    var e = 1.0;

    for (1..n) { |i|
        e += (1 / i.factorial);
    }

    return e;
}


say pi(120);
say e(10);
