Skip to content

Instantly share code, notes, and snippets.

View TrueWill's full-sized avatar

Bill Sorensen TrueWill

View GitHub Profile
@TrueWill
TrueWill / index.ts
Created May 23, 2020 22:15
Tzientist demo
import * as scientist from 'tzientist';
// Gregory-Leibniz series to calculate Pi
// from https://stackoverflow.com/questions/39574989/calculating-pi-in-javascript-using-gregory-leibniz-series
function oldPi(): number {
const n = 4000;
let v = 0;
for (let i = 1; i <= n; i += 4) {
v += 1 / i - 1 / (i + 2);