diff options
| author | wukong <wukong@longaeva> | 2018-09-30 00:53:52 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2018-09-30 00:53:52 -0700 |
| commit | 6375b4618439865e2c975aaa5bb30623e9082df3 (patch) | |
| tree | 7b01f8e917169e3aee1d73fc888b497d32a41e32 /pi.sh | |
| parent | d1f6c89be163d9399d569e01458242d8ce15e041 (diff) | |
added fib.awk, a solution to fib eqn (example in Hamming text);
removed pi.sh (redundant);
added corrections to quad_reg
Diffstat (limited to 'pi.sh')
| -rw-r--r-- | pi.sh | 24 |
1 files changed, 0 insertions, 24 deletions
@@ -1,24 +0,0 @@ -#!/bin/sh - -### pi.sh, https://en.wikipedia.org/wiki/Pi -# In 1706 John Machin used the Gregory–Leibniz series to produce an algorithm -# that converged much faster. Machin reached 100 digits of π with this -# formula. Other mathematicians created variants, now known as Machin-like -# formulae, that were used to set several successive records for calculating -# digits of π. Machin-like formulae remained the best-known method for -# calculating π well into the age of computers, and were used to set records -# for 250 years, culminating in a 620-digit approximation in 1946 by Daniel -# Ferguson–the best approximation achieved without the aid of a calculating -# device. - -awk -v fig=${1} ' - function pi() { - return 4*(4*atan2(1,5) - atan2(1,239)) - } - BEGIN { - if (fig <= 0) - fig = 6 - str = "%." fig "g\n" - printf(str, pi()) - } -' |
