/
niceSOFT
/
gawk
Обзор
Документация
Войти
/
niceSOFT
/
gawk
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
test/fmtmix.awk
18 строк
482 B
Arnold D. Robbins
Track which of OFMT or CONVFMT was used to format a string value.
24 июн 2026, 18:34
24 июн 2026, 18:34
8078775
Код
Авторство
О чём код?
# input is # 5 3 { CONVFMT="%.3f" OFMT="%03e" print $1 # expect: 5 $0 = $1/$2 print # expect: 1.666667e+00 print "" $1 # expect: 1.667 CONVFMT="%.0f" OFMT="%.0e" print $1 # expect 2 - printf "%.0f\n" 1.666667 ---> 2 # The above is a little surprising. The flow is that $1 gets # the numeric value 1.666667 from $0, and is converted via CONVFMT # to get a string value, and that's what's printed. This is # definitely dark corner territory. print # expect: 2e+00 }