/
niceSOFT
/
gawk
Обзор
Документация
Войти
/
niceSOFT
/
gawk
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
awklib/eg/prog/pi.awk
26 строк
554 B
Arnold D. Robbins
Document intdiv extension in the manual.
15 апр 2026, 16:24
15 апр 2026, 16:24
cf2e05a
Код
Авторство
О чём код?
# pi.awk --- compute the digits of pi # # This file and how to use it are described in the manual. # Therefore, we respectfully advise you to Read The Fine Manual # for more information. # # Katie Wasserman, katie@wass.net # August 2014 # # Adjusted to use intdiv extension, April 2026 @load "intdiv" BEGIN { digits = 100000 two = 2 * 10 ^ digits pi = two for (m = digits * 4; m > 0; --m) { d = m * 2 + 1 x = pi * m intdiv(x, d, result) pi = result["quotient"] pi = pi + two } print pi }