#include <stdio.h>

// Calculate 'e' using e=1+1/1!+1/2!+1/3!+1/4!+...
// 8! is 8x7x6x5x4x3x2x1. The series converges rapidly to e.

int fact(int x) { return x > 0 ? x * fact(x-1) : 1; }

int main(void) {
    float last_e, e;
    int i, max_first = fact(8), max_last = fact(7);

    for(e = 1.f, i = 1; i < max_first; i *= i+1 )
        e += 1.f / i;

    last_e = e;

    for(e = 1.f, i = 1; i < max_last; i *= i+1 )
        e += 1.f / i;

    if( last_e < e + 1.f / (i*8) )
        printf("more precision detected!\n");

    printf("first: %.80f\nlast : %.80f \n", last_e, e + 1.f / (i*8));

    return 0;
}
