From 4c4eb1bd8f003b3b57707badd2dd089ed193a896 Mon Sep 17 00:00:00 2001 From: wukong Date: Fri, 10 Apr 2026 23:46:12 -0700 Subject: renamed fir window generators; minor edits to whitespace and comments for more consistent style; --- pi.awk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pi.awk') diff --git a/pi.awk b/pi.awk index 69eb36e..0a529f8 100644 --- a/pi.awk +++ b/pi.awk @@ -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()) } + -- cgit v1.2.3