diff options
| author | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
| commit | 4c4eb1bd8f003b3b57707badd2dd089ed193a896 (patch) | |
| tree | 15b62907fffd70c46a9b4369df93ab33c6aa88ac /pi.awk | |
| parent | e7d1781578e846a7b1d634cd43c8fab00a67b883 (diff) | |
renamed fir window generators;
minor edits to whitespace and comments for more consistent style;
Diffstat (limited to '')
| -rw-r--r-- | pi.awk | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,4 +1,4 @@ -#! /usr/bin/awk -f +#!/usr/bin/awk -f ### pi.awk, https://en.wikipedia.org/wiki/Pi # In 1706 John Machin used the Gregory–Leibniz series to produce an algorithm @@ -11,11 +11,14 @@ # Ferguson–the best approximation achieved without the aid of a calculating # device. + function pi() { return 4*(4*atan2(1,5) - atan2(1,239)) } + BEGIN { ARGV[1] ? OFMT = "%." ARGV[1] "g" : OFMT = "%g" printf(OFMT ORS, pi()) } + |
