TODO done

replacing long with double should avoid overflows, double max value is
x*10^134 while long only has x*10^18