diff options
Diffstat (limited to 'doc/gawk.info')
-rw-r--r-- | doc/gawk.info | 333 |
1 files changed, 178 insertions, 155 deletions
diff --git a/doc/gawk.info b/doc/gawk.info index 68aa1848..b42f26e5 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -23137,6 +23137,25 @@ cause any accumulating round-off error to cancel itself out. This is the default rounding mode for IEEE 754 computing functions and operators. + Rounding Modes and Conversion + + It's important to understand that, along with 'CONVFMT' and 'OFMT', +the rounding mode affects how numbers are converted to strings. For +example, consider the following program: + + BEGIN { + pi = 3.1416 + OFMT = "%.f" # Print value as integer + print pi # ROUNDMODE = "N" by default. + ROUNDMODE = "U" # Now change ROUNDMODE + print pi + } + +Running this program produces this output: + + $ gawk -M -f roundmode.awk + -| 3 + -| 4 The other rounding modes are rarely used. Rounding toward positive infinity ('roundTowardPositive') and toward negative infinity ('roundTowardNegative') are often used to implement interval arithmetic, @@ -35423,6 +35442,8 @@ Index * round() user-defined function: Round Function. (line 16) * rounding numbers: Round Function. (line 6) * ROUNDMODE variable: User-modified. (line 131) +* ROUNDMODE variable <1>: Setting the rounding mode. + (line 6) * RS variable: awk split records. (line 12) * RS variable <1>: User-modified. (line 136) * RS variable, multiline records and: Multiple Line. (line 17) @@ -35550,6 +35571,8 @@ Index * sidebar, Pre-POSIX awk Used OFMT for String Conversion: Strings And Numbers. (line 54) * sidebar, Recipe for a Programming Language: History. (line 6) +* sidebar, Rounding Modes and Conversion: Setting the rounding mode. + (line 65) * sidebar, RS = "\0" Is Not Portable: gawk split records. (line 63) * sidebar, So Why Does gawk Have BEGINFILE and ENDFILE?: Filetrans Function. (line 83) @@ -36375,160 +36398,160 @@ Node: Setting precision933040 Ref: table-predefined-precision-strings933737 Node: Setting the rounding mode935567 Ref: table-gawk-rounding-modes935941 -Ref: Setting the rounding mode-Footnote-1939316 -Node: Arbitrary Precision Integers939495 -Ref: Arbitrary Precision Integers-Footnote-1942670 -Node: Checking for MPFR942819 -Node: POSIX Floating Point Problems944116 -Ref: POSIX Floating Point Problems-Footnote-1947987 -Node: Floating point summary948025 -Node: Dynamic Extensions950215 -Node: Extension Intro951768 -Node: Plugin License953034 -Node: Extension Mechanism Outline953831 -Ref: figure-load-extension954270 -Ref: figure-register-new-function955835 -Ref: figure-call-new-function956927 -Node: Extension API Description958989 -Node: Extension API Functions Introduction960631 -Node: General Data Types966171 -Ref: General Data Types-Footnote-1974532 -Node: Memory Allocation Functions974831 -Ref: Memory Allocation Functions-Footnote-1979041 -Node: Constructor Functions979140 -Node: Registration Functions982726 -Node: Extension Functions983411 -Node: Exit Callback Functions988626 -Node: Extension Version String989876 -Node: Input Parsers990539 -Node: Output Wrappers1003260 -Node: Two-way processors1007772 -Node: Printing Messages1010037 -Ref: Printing Messages-Footnote-11011208 -Node: Updating ERRNO1011361 -Node: Requesting Values1012100 -Ref: table-value-types-returned1012837 -Node: Accessing Parameters1013773 -Node: Symbol Table Access1015008 -Node: Symbol table by name1015520 -Node: Symbol table by cookie1017309 -Ref: Symbol table by cookie-Footnote-11021494 -Node: Cached values1021558 -Ref: Cached values-Footnote-11025094 -Node: Array Manipulation1025247 -Ref: Array Manipulation-Footnote-11026338 -Node: Array Data Types1026375 -Ref: Array Data Types-Footnote-11029033 -Node: Array Functions1029125 -Node: Flattening Arrays1033623 -Node: Creating Arrays1040599 -Node: Redirection API1045366 -Node: Extension API Variables1048199 -Node: Extension Versioning1048910 -Ref: gawk-api-version1049339 -Node: Extension GMP/MPFR Versioning1051070 -Node: Extension API Informational Variables1052698 -Node: Extension API Boilerplate1053771 -Node: Changes from API V11057745 -Node: Finding Extensions1059317 -Node: Extension Example1059876 -Node: Internal File Description1060674 -Node: Internal File Ops1064754 -Ref: Internal File Ops-Footnote-11076105 -Node: Using Internal File Ops1076245 -Ref: Using Internal File Ops-Footnote-11078628 -Node: Extension Samples1078902 -Node: Extension Sample File Functions1080431 -Node: Extension Sample Fnmatch1088080 -Node: Extension Sample Fork1089567 -Node: Extension Sample Inplace1090785 -Node: Extension Sample Ord1094002 -Node: Extension Sample Readdir1094838 -Ref: table-readdir-file-types1095727 -Node: Extension Sample Revout1096532 -Node: Extension Sample Rev2way1097121 -Node: Extension Sample Read write array1097861 -Node: Extension Sample Readfile1099803 -Node: Extension Sample Time1100898 -Node: Extension Sample API Tests1102246 -Node: gawkextlib1102738 -Node: Extension summary1105194 -Node: Extension Exercises1108896 -Node: Language History1110394 -Node: V7/SVR3.11112050 -Node: SVR41114202 -Node: POSIX1115636 -Node: BTL1117016 -Node: POSIX/GNU1117745 -Node: Feature History1123523 -Node: Common Extensions1139382 -Node: Ranges and Locales1140665 -Ref: Ranges and Locales-Footnote-11145281 -Ref: Ranges and Locales-Footnote-21145308 -Ref: Ranges and Locales-Footnote-31145543 -Node: Contributors1145764 -Node: History summary1151709 -Node: Installation1153089 -Node: Gawk Distribution1154033 -Node: Getting1154517 -Node: Extracting1155480 -Node: Distribution contents1157118 -Node: Unix Installation1163598 -Node: Quick Installation1164280 -Node: Shell Startup Files1166694 -Node: Additional Configuration Options1167783 -Node: Configuration Philosophy1170076 -Node: Non-Unix Installation1172445 -Node: PC Installation1172905 -Node: PC Binary Installation1173743 -Node: PC Compiling1174178 -Node: PC Using1175295 -Node: Cygwin1178340 -Node: MSYS1179110 -Node: VMS Installation1179611 -Node: VMS Compilation1180402 -Ref: VMS Compilation-Footnote-11181631 -Node: VMS Dynamic Extensions1181689 -Node: VMS Installation Details1183374 -Node: VMS Running1185627 -Node: VMS GNV1189906 -Node: VMS Old Gawk1190641 -Node: Bugs1191112 -Node: Bug address1191775 -Node: Usenet1194567 -Node: Maintainers1195344 -Node: Other Versions1196605 -Node: Installation summary1203367 -Node: Notes1204569 -Node: Compatibility Mode1205434 -Node: Additions1206216 -Node: Accessing The Source1207141 -Node: Adding Code1208578 -Node: New Ports1214797 -Node: Derived Files1219285 -Ref: Derived Files-Footnote-11224931 -Ref: Derived Files-Footnote-21224966 -Ref: Derived Files-Footnote-31225564 -Node: Future Extensions1225678 -Node: Implementation Limitations1226336 -Node: Extension Design1227519 -Node: Old Extension Problems1228673 -Ref: Old Extension Problems-Footnote-11230191 -Node: Extension New Mechanism Goals1230248 -Ref: Extension New Mechanism Goals-Footnote-11233612 -Node: Extension Other Design Decisions1233801 -Node: Extension Future Growth1235914 -Node: Old Extension Mechanism1236750 -Node: Notes summary1238513 -Node: Basic Concepts1239695 -Node: Basic High Level1240376 -Ref: figure-general-flow1240658 -Ref: figure-process-flow1241343 -Ref: Basic High Level-Footnote-11244644 -Node: Basic Data Typing1244829 -Node: Glossary1248157 -Node: Copying1279995 -Node: GNU Free Documentation License1317534 -Node: Index1342652 +Ref: Setting the rounding mode-Footnote-1939871 +Node: Arbitrary Precision Integers940050 +Ref: Arbitrary Precision Integers-Footnote-1943225 +Node: Checking for MPFR943374 +Node: POSIX Floating Point Problems944671 +Ref: POSIX Floating Point Problems-Footnote-1948542 +Node: Floating point summary948580 +Node: Dynamic Extensions950770 +Node: Extension Intro952323 +Node: Plugin License953589 +Node: Extension Mechanism Outline954386 +Ref: figure-load-extension954825 +Ref: figure-register-new-function956390 +Ref: figure-call-new-function957482 +Node: Extension API Description959544 +Node: Extension API Functions Introduction961186 +Node: General Data Types966726 +Ref: General Data Types-Footnote-1975087 +Node: Memory Allocation Functions975386 +Ref: Memory Allocation Functions-Footnote-1979596 +Node: Constructor Functions979695 +Node: Registration Functions983281 +Node: Extension Functions983966 +Node: Exit Callback Functions989181 +Node: Extension Version String990431 +Node: Input Parsers991094 +Node: Output Wrappers1003815 +Node: Two-way processors1008327 +Node: Printing Messages1010592 +Ref: Printing Messages-Footnote-11011763 +Node: Updating ERRNO1011916 +Node: Requesting Values1012655 +Ref: table-value-types-returned1013392 +Node: Accessing Parameters1014328 +Node: Symbol Table Access1015563 +Node: Symbol table by name1016075 +Node: Symbol table by cookie1017864 +Ref: Symbol table by cookie-Footnote-11022049 +Node: Cached values1022113 +Ref: Cached values-Footnote-11025649 +Node: Array Manipulation1025802 +Ref: Array Manipulation-Footnote-11026893 +Node: Array Data Types1026930 +Ref: Array Data Types-Footnote-11029588 +Node: Array Functions1029680 +Node: Flattening Arrays1034178 +Node: Creating Arrays1041154 +Node: Redirection API1045921 +Node: Extension API Variables1048754 +Node: Extension Versioning1049465 +Ref: gawk-api-version1049894 +Node: Extension GMP/MPFR Versioning1051625 +Node: Extension API Informational Variables1053253 +Node: Extension API Boilerplate1054326 +Node: Changes from API V11058300 +Node: Finding Extensions1059872 +Node: Extension Example1060431 +Node: Internal File Description1061229 +Node: Internal File Ops1065309 +Ref: Internal File Ops-Footnote-11076660 +Node: Using Internal File Ops1076800 +Ref: Using Internal File Ops-Footnote-11079183 +Node: Extension Samples1079457 +Node: Extension Sample File Functions1080986 +Node: Extension Sample Fnmatch1088635 +Node: Extension Sample Fork1090122 +Node: Extension Sample Inplace1091340 +Node: Extension Sample Ord1094557 +Node: Extension Sample Readdir1095393 +Ref: table-readdir-file-types1096282 +Node: Extension Sample Revout1097087 +Node: Extension Sample Rev2way1097676 +Node: Extension Sample Read write array1098416 +Node: Extension Sample Readfile1100358 +Node: Extension Sample Time1101453 +Node: Extension Sample API Tests1102801 +Node: gawkextlib1103293 +Node: Extension summary1105749 +Node: Extension Exercises1109451 +Node: Language History1110949 +Node: V7/SVR3.11112605 +Node: SVR41114757 +Node: POSIX1116191 +Node: BTL1117571 +Node: POSIX/GNU1118300 +Node: Feature History1124078 +Node: Common Extensions1139937 +Node: Ranges and Locales1141220 +Ref: Ranges and Locales-Footnote-11145836 +Ref: Ranges and Locales-Footnote-21145863 +Ref: Ranges and Locales-Footnote-31146098 +Node: Contributors1146319 +Node: History summary1152264 +Node: Installation1153644 +Node: Gawk Distribution1154588 +Node: Getting1155072 +Node: Extracting1156035 +Node: Distribution contents1157673 +Node: Unix Installation1164153 +Node: Quick Installation1164835 +Node: Shell Startup Files1167249 +Node: Additional Configuration Options1168338 +Node: Configuration Philosophy1170631 +Node: Non-Unix Installation1173000 +Node: PC Installation1173460 +Node: PC Binary Installation1174298 +Node: PC Compiling1174733 +Node: PC Using1175850 +Node: Cygwin1178895 +Node: MSYS1179665 +Node: VMS Installation1180166 +Node: VMS Compilation1180957 +Ref: VMS Compilation-Footnote-11182186 +Node: VMS Dynamic Extensions1182244 +Node: VMS Installation Details1183929 +Node: VMS Running1186182 +Node: VMS GNV1190461 +Node: VMS Old Gawk1191196 +Node: Bugs1191667 +Node: Bug address1192330 +Node: Usenet1195122 +Node: Maintainers1195899 +Node: Other Versions1197160 +Node: Installation summary1203922 +Node: Notes1205124 +Node: Compatibility Mode1205989 +Node: Additions1206771 +Node: Accessing The Source1207696 +Node: Adding Code1209133 +Node: New Ports1215352 +Node: Derived Files1219840 +Ref: Derived Files-Footnote-11225486 +Ref: Derived Files-Footnote-21225521 +Ref: Derived Files-Footnote-31226119 +Node: Future Extensions1226233 +Node: Implementation Limitations1226891 +Node: Extension Design1228074 +Node: Old Extension Problems1229228 +Ref: Old Extension Problems-Footnote-11230746 +Node: Extension New Mechanism Goals1230803 +Ref: Extension New Mechanism Goals-Footnote-11234167 +Node: Extension Other Design Decisions1234356 +Node: Extension Future Growth1236469 +Node: Old Extension Mechanism1237305 +Node: Notes summary1239068 +Node: Basic Concepts1240250 +Node: Basic High Level1240931 +Ref: figure-general-flow1241213 +Ref: figure-process-flow1241898 +Ref: Basic High Level-Footnote-11245199 +Node: Basic Data Typing1245384 +Node: Glossary1248712 +Node: Copying1280550 +Node: GNU Free Documentation License1318089 +Node: Index1343207 End Tag Table |