diff options
author | john haque <j.eh@mchsi.com> | 2012-04-02 06:11:59 -0500 |
---|---|---|
committer | john haque <j.eh@mchsi.com> | 2012-04-02 06:11:59 -0500 |
commit | cb86918d50c3758d9cd2f4d75c73ff590cc75b04 (patch) | |
tree | 6b0b5505dbb262a24a4d3babb8603cd3564008c9 | |
parent | a11e3c290c877c3ffc11e886edb95199a31fac2b (diff) | |
download | egawk-cb86918d50c3758d9cd2f4d75c73ff590cc75b04.tar.gz egawk-cb86918d50c3758d9cd2f4d75c73ff590cc75b04.tar.bz2 egawk-cb86918d50c3758d9cd2f4d75c73ff590cc75b04.zip |
MPFR related documentation updates and code cleanups.
-rw-r--r-- | ChangeLog | 68 | ||||
-rw-r--r-- | README_d/ChangeLog | 3 | ||||
-rw-r--r-- | doc/gawk.1 | 11 | ||||
-rw-r--r-- | doc/gawk.info | 937 | ||||
-rw-r--r-- | doc/gawk.texi | 64 | ||||
-rw-r--r-- | io.c | 12 | ||||
-rw-r--r-- | m4/ChangeLog | 3 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | test/ChangeLog | 11 | ||||
-rw-r--r-- | test/badargs.ok | 2 |
10 files changed, 615 insertions, 500 deletions
@@ -1,3 +1,71 @@ +2012-04-02 John Haque <j.eh@mchsi.com> + + Add support for arbitrary-precision arithmetic. + + * mpfr.c: New file. + * awk.h (struct exp_node): Add union to handle different number types. + (MPFN, MPZN): New flag values. + (DO_MPFR, do_mpfr): New defines. + (PREC_node, RNDMODE_node): Add declarations. + (PRECISION, RND_MODE, MNR, MFNR, mpzval, do_ieee_fmt): Add declarations. + (make_number, str2number, format_val, cmp_numbers): Ditto. + (force_number): Change definition. + (Func_pre_exec, Func_post_exec): New typedefs. + (POP_NUMBER, TOP_NUMBER): Change definitions. + (get_number_ui, get_number_si, get_number_d, get_number_uj, + iszero, IEEE_FMT, mpg_float, mpg_integer, mpg_float, + mpg_integer): New defines. + * awkgram.y (tokentab): Add alternate function entries for MPFR/GMP. + (snode): Choose the appropriate function. + (negate_num): New function to negate a number. + (grammar): Use it. + (yylex): Adjust number handling code. + * array.c (value_info, asort_actual, sort_user_func): Adjust for + MPFR/GMP numbers. + (do_adump, indent): Minor changes. + (sort_up_index_number, sort_up_value_number, sort_up_value_type): Use + cmp_numbers() for numeric comparisons. + * builtin.c (mpz2mpfr): New function. + (format_tree): Adjust to handle MPFR and GMP numbers. + * eval.c (register_exec_hook): New function to manage interpreter hooks. + (num_exec_hook, pre_execute, post_execute): New and adjusted definitions. + (h_interpret): Renamed from debug_interpret. + (init_interpret): Changed to use the new name. + (flags2str): New entries for MPFN and MPZN. + (cmp_nodes): Reworked to use seperate routine for numeric comparisons. + (set_IGNORECASE, set_BINMODE, set_LINT, update_NR, update_FNR, + update_NF): Adjust code and some cleanup. + * field.c (rebuild_record): Field copying code reworked to handle + MPFR/GMP numbers. + (set_NF): Minor adjustment. + * io.c (INCREMENT_REC): New macro. + (inrec, do_getline): Use the new macro. + (nextfile, set_NR, set_FNR, get_read_timeout, pty_vs_pipe): Adjust code + to handle MPFR/GMP numbers. + * interpret.h (r_interpret): Adjust TOP_NUMBER/POP_NUMBER usage. + (EXEC_HOOK): New macro and definition. + (DEBUGGING): Removed. + * main.c (DEFAULT_PREC, DEFAULT_RNDMODE): New defines. + (opttab): New entry for option arbitrary-precision. + (main): Handle the new option. + (usage): Add to usage message. + (varinit): Add PREC and RNDMODE. + (load_procinfo): Install MPFR and GMP related items. + (version): Append MPFR and GMP versions to message. + * msg.c (err) : Adjust FNR handling with MPFR/GMP. + * node.c (r_format_val): Renamed from format_val. + (r_force_number): Return NODE * instead of AWKNUM. + (make_number, str2number, format_val, cmp_numpers: Defined and initialized. + (r_unref): Free MPFR/MPZ numbers. + (get_numbase): Renamed from isnondecimal and return the base. + (cmp_awknums): New function to compare two AWKNUMs. + * command.y (yylex): Adjust number handling code. + (grammar): Minor adjustments to handle negative numbers. + * debug.c (init_debug): New function. + (do_info, do_set_var, watchpoint_triggered, serialize, + initialize_watch_item, do_watch, print_watch_item): Minor adjustments. + (debug_pre_execute): Adjusted to handle MPFR and GMP numbers. + 2012-01-02 Arnold D. Robbins <arnold@skeeve.com> * io.c (Read_can_timeout, Read_timeout, Read_default_timeout): diff --git a/README_d/ChangeLog b/README_d/ChangeLog index 945ba215..5424385c 100644 --- a/README_d/ChangeLog +++ b/README_d/ChangeLog @@ -1,3 +1,6 @@ +2012-04-01 John Haque <j.eh@mchsi.com> + README.mpfr: New file. + 2011-07-29 Arnold D. Robbins <arnold@skeeve.com> * README.pc: Add download location info for DJGPP version. @@ -358,7 +358,7 @@ actually invalid are issued. (This is not fully implemented yet.) .B \-M .TP .PD -.B \-\^\-bcmath +.B \-\^\-arbitrary-precision Force arbitrary precision arithmetic on numbers. This option has no effect if .I gawk @@ -1178,11 +1178,12 @@ the version of The rounding mode to use for arbitrary precision arithmetic on numbers, by default \fB"N"\fR (IEEE-754 roundTiesToEven mode). The accepted values are -\fB"U"\fR for roundTowardPositive, -\fB"D"\fR for roundTowardNegative, -\fB"Z"\fR for roundTowardZero, +\fB"N"\fR or \fB"n"\fR for roundTowardPositive, +\fB"U"\fR or \fB"u"\fR for roundTowardPositive, +\fB"D"\fR or \fB"d"\fR for roundTowardNegative, +\fB"Z"\fR or \fB"z"\fR for roundTowardZero, and if your version of GNU MPFR library supports it, -\fB"A"\fR for roundTiesToAway. +\fB"A"\fR or \fB"a"\fR for roundTiesToAway. .TP .B RS The input record separator, by default a newline. diff --git a/doc/gawk.info b/doc/gawk.info index 8cc0672d..8b365437 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -2311,7 +2311,7 @@ The following list describes options mandated by the POSIX standard: doing so is not burdensome. `-M' -`--bcmath' +`--arbitrary-precision' Force arbitrary precision arithmetic on numbers. This option has no effect if `gawk' is not compiled to use the GNU MPFR and MP libraries (*note Arbitrary Precision Arithmetic::). @@ -9320,6 +9320,15 @@ specific to `gawk' are marked with a pound sign (`#'). every `print' statement. Its default value is `"\n"', the newline character. (*Note Output Separators::.) +`PREC #' + The working precision of arbitrary precision floating-point + numbers, 53 by default. (*Note Setting Precision::.) + +`RNDMODE #' + The rounding mode to use for arbitrary precision arithmetic on + numbers, by default `"N"' (`roundTiesToEven' in IEEE-754 standard). + (*Note Setting Rounding Mode::.) + `RS' This is `awk''s input record separator. Its default value is a string containing a single newline character, which means that an @@ -9525,6 +9534,23 @@ with a pound sign (`#'). `PROCINFO["version"]' The version of `gawk'. + The following additional elements in the array are available to + provide information about the MPFR and GMP libraries if your + version of `gawk' supports arbitrary precision numbers (*note + Arbitrary Precision Arithmetic::): + + `PROCINFO["mpfr_version"]' + The version of the GNU MPFR library. + + `PROCINFO["gmp_version"]' + The version of the GNU MP library. + + `PROCINFO["prec_max"]' + The maximum precision supported by MPFR. + + `PROCINFO["prec_min"]' + The minimum precision required by MPFR. + On some systems, there may be elements in the array, `"group1"' through `"groupN"' for some N. N is the number of supplementary groups that the process has. Use the `in' operator to test for @@ -13667,7 +13693,7 @@ numbers. * Changing Precision:: Changing the Precision of a Number. * Exact Arithmetic:: Exact Arithmetic with Floating-point Numbers. * Integer Programming:: Effective Integer Programming. -* Arbitrary Precision Integers:: Arbitrary Precision Integer. +* Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with `gawk'. * MPFR and GMP Libraries:: Information About the MPFR and GMP Libraries. @@ -13819,7 +13845,7 @@ range for exponents. The context has the following primary components: `emin' Minimum exponent allowed for this format. -`subnormal behavior' +`underflow behavior' The format may or may not support gradual underflow. `rounding' @@ -13952,21 +13978,21 @@ File: gawk.info, Node: Arbitrary Precision Floats, Next: Setting Precision, P Gawk uses the GNU MPFR library for arbitrary precision floating-point arithmetic. The MPFR library provides precise control over precisions and rounding modes, and gives correctly rounded reproducible -platform-independent results. With the command-line option `--bcmath' -or `-M', all floating-point arithmetic operators and numeric functions -can yield results to any desired precision level supported by MPFR. Two -built-in variables `PREC' (*note Setting Precision::) and `RNDMODE' -(*note Setting Rounding Mode::) give a simple way of controlling the -working precision and the rounding mode in `gawk'. The precision and -the rounding mode are set globally for every operation to follow. The -default working precision for arbitrary precision floats is 53(1) and -the default value for `RNDMODE' is `"N"' which selects the IEEE-754 -`roundTiesToEven' (*note Rounding Mode::) rounding mode. The default -exponent range in MPFR (EMAX = 2^30 - 1, EMIN = -EMAX) is used by -`gawk' for all floating-point contexts. There is no explicit mechanism -in `gawk' to adjust the exponent range. MPFR does not implement -subnormal numbers by default, and this behavior cannot be changed in -`gawk'. +platform-independent results. With the command-line option +`--arbitrary-precision' or `-M', all floating-point arithmetic +operators and numeric functions can yield results to any desired +precision level supported by MPFR. Two built-in variables `PREC' (*note +Setting Precision::) and `RNDMODE' (*note Setting Rounding Mode::) give +a simple way of controlling the working precision and the rounding mode +in `gawk'. The precision and the rounding mode are set globally for +every operation to follow. The default working precision for arbitrary +precision floats is 53(1) and the default value for `RNDMODE' is `"N"' +which selects the IEEE-754 `roundTiesToEven' (*note Rounding Mode::) +rounding mode. The default exponent range in MPFR (EMAX = 2^30 - 1, +EMIN = -EMAX) is used by `gawk' for all floating-point contexts. There +is no explicit mechanism in `gawk' to adjust the exponent range. MPFR +does not implement subnormal numbers by default, and this behavior +cannot be changed in `gawk'. NOTE: When emulating an IEEE-754 format (*note Setting Precision::), `gawk' internally adjusts the exponent range to the @@ -14145,7 +14171,7 @@ easy answers. The standard rules of algebra often do not apply when using floating-point arithmetic. Among other things, the distributive and associative laws do not hold completely, and order of operation may be important for your computation. Rounding error, cumulative precision -loss, and underflow are often troublesome. +loss and underflow are often troublesome. When `gawk' tests the expressions 0.1 + 12.2 and 12.3 for equality using the machine double precision arithmetic it decides that they are @@ -14233,14 +14259,14 @@ File: gawk.info, Node: Arbitrary Precision Integers, Next: MPFR and GMP Librar 11.12 Arbitrary Precision Integer Arithmetic with `gawk' ======================================================== -If the option `--bcmath' or `-M' is specified, `gawk' will perform all -integer arithmetic using GMP arbitrary precision integers. Any number -that looks like an integer in a program source or data file will be -stored as an arbitrary precision integer. The size of the integer is -limited only by your computer's memory. The current floating-point -context has no effect on operations involving integers. For example, -the following computes 5^4^3^2, the result of which is beyond the -limits of ordinary `gawk' numbers: +If the option `--arbitrary-precision' or `-M' is specified, `gawk' will +perform all integer arithmetic using GMP arbitrary precision integers. +Any number that looks like an integer in a program source or data file +will be stored as an arbitrary precision integer. The size of the +integer is limited only by your computer's memory. The current +floating-point context has no effect on operations involving integers. +For example, the following computes 5^4^3^2, the result of which is +beyond the limits of ordinary `gawk' numbers: $ gawk -M 'BEGIN { > x = 5^4^3^2 @@ -14300,21 +14326,8 @@ File: gawk.info, Node: MPFR and GMP Libraries, Prev: Arbitrary Precision Integ 11.13 Information About the MPFR and GMP Libraries ================================================== -The following elements of the PROCINFO array (*note Built-in -Variables::) are available to provide information about the MPFR and -GMP libraries: - -`PROCINFO["mpfr_version"]' - The version of the GNU MPFR library. - -`PROCINFO["gmp_version"]' - The version of the GNU MP library. - -`PROCINFO["prec_max"]' - The maximum precision supported by MPFR. - -`PROCINFO["prec_min"]' - The minimum precision required by MPFR. +There are few elements available in the `PROCINFO' array to provide +information about the MPFR and GMP libraries. (*Note Auto-set::.) File: gawk.info, Node: Advanced Features, Next: Library Functions, Prev: Arbitrary Precision Arithmetic, Up: Top @@ -25599,8 +25612,8 @@ Index * - (hyphen), -= operator: Assignment Ops. (line 129) * - (hyphen), filenames beginning with: Options. (line 59) * - (hyphen), in bracket expressions: Bracket Expressions. (line 17) +* --arbitrary-precision option: Options. (line 182) * --assign option: Options. (line 32) -* --bcmath option: Options. (line 182) * --c option: Options. (line 78) * --characters-as-bytes option: Options. (line 68) * --copyright option: Options. (line 85) @@ -25811,7 +25824,7 @@ Index (line 67) * advanced features, data files as single record: Records. (line 175) * advanced features, fixed-width data: Constant Size. (line 9) -* advanced features, FNR/NR variables: Auto-set. (line 207) +* advanced features, FNR/NR variables: Auto-set. (line 224) * advanced features, gawk: Advanced Features. (line 6) * advanced features, gawk, network programming: TCP/IP Networking. (line 6) @@ -26323,7 +26336,7 @@ Index (line 47) * dark corner, FILENAME variable <1>: Auto-set. (line 92) * dark corner, FILENAME variable: Getline Notes. (line 19) -* dark corner, FNR/NR variables: Auto-set. (line 207) +* dark corner, FNR/NR variables: Auto-set. (line 224) * dark corner, format-control characters: Control Letters. (line 18) * dark corner, FS as null string: Single Character Fields. (line 20) @@ -26522,7 +26535,7 @@ Index * differences in awk and gawk, regular expressions: Case-sensitivity. (line 26) * differences in awk and gawk, RS/RT variables: Records. (line 167) -* differences in awk and gawk, RT variable: Auto-set. (line 196) +* differences in awk and gawk, RT variable: Auto-set. (line 213) * differences in awk and gawk, single-character fields: Single Character Fields. (line 6) * differences in awk and gawk, split() function: String Functions. @@ -26532,7 +26545,7 @@ Index * differences in awk and gawk, strtonum() function (gawk): String Functions. (line 404) * differences in awk and gawk, TEXTDOMAIN variable: User-modified. - (line 153) + (line 162) * differences in awk and gawk, trunc-mod operation: Arithmetic Ops. (line 66) * directories, changing: Sample Library. (line 6) @@ -26805,7 +26818,7 @@ Index * floating-point, numbers, AWKNUM internal type: Internals. (line 19) * FNR variable <1>: Auto-set. (line 102) * FNR variable: Records. (line 6) -* FNR variable, changing: Auto-set. (line 207) +* FNR variable, changing: Auto-set. (line 224) * for statement: For Statement. (line 6) * for statement, in arrays: Scanning an Array. (line 20) * force_number() internal function: Internals. (line 27) @@ -26980,7 +26993,7 @@ Index * gawk, regular expressions, operators: GNU Regexp Operators. (line 6) * gawk, regular expressions, precedence: Regexp Operators. (line 157) -* gawk, RT variable in <1>: Auto-set. (line 196) +* gawk, RT variable in <1>: Auto-set. (line 213) * gawk, RT variable in <2>: Getline/Variable/File. (line 10) * gawk, RT variable in <3>: Multiple Line. (line 129) @@ -26989,7 +27002,7 @@ Index * gawk, source code, obtaining: Getting. (line 6) * gawk, splitting fields and: Constant Size. (line 87) * gawk, string-translation functions: I18N Functions. (line 6) -* gawk, TEXTDOMAIN variable in: User-modified. (line 153) +* gawk, TEXTDOMAIN variable in: User-modified. (line 162) * gawk, timestamps: Time Functions. (line 6) * gawk, uses for: Preface. (line 36) * gawk, versions of, information about, printing: Options. (line 274) @@ -27201,7 +27214,7 @@ Index * internationalization: I18N Functions. (line 6) * internationalization, localization <1>: Internationalization. (line 13) -* internationalization, localization: User-modified. (line 153) +* internationalization, localization: User-modified. (line 162) * internationalization, localization, character classes: Bracket Expressions. (line 90) * internationalization, localization, gawk and: Internationalization. @@ -27440,7 +27453,7 @@ Index * not Boolean-logic operator: Boolean Ops. (line 6) * NR variable <1>: Auto-set. (line 118) * NR variable: Records. (line 6) -* NR variable, changing: Auto-set. (line 207) +* NR variable, changing: Auto-set. (line 224) * null strings <1>: Basic Data Typing. (line 50) * null strings <2>: Truth Values. (line 6) * null strings <3>: Regexp Field Splitting. @@ -27681,7 +27694,8 @@ Index * POSIX, gawk extensions not included in: POSIX/GNU. (line 6) * POSIX, programs, implementing in awk: Clones. (line 6) * POSIXLY_CORRECT environment variable: Options. (line 313) -* PREC variable: Setting Precision. (line 6) +* PREC variable <1>: Setting Precision. (line 6) +* PREC variable: User-modified. (line 134) * precedence <1>: Precedence. (line 6) * precedence: Increment Ops. (line 61) * precedence, regexp operators: Regexp Operators. (line 152) @@ -27727,10 +27741,8 @@ Index * PROCINFO array <3>: Group Functions. (line 6) * PROCINFO array <4>: Passwd Functions. (line 6) * PROCINFO array <5>: Two-way I/O. (line 116) -* PROCINFO array <6>: MPFR and GMP Libraries. - (line 6) -* PROCINFO array <7>: Time Functions. (line 46) -* PROCINFO array <8>: Auto-set. (line 123) +* PROCINFO array <6>: Time Functions. (line 46) +* PROCINFO array <7>: Auto-set. (line 123) * PROCINFO array: Obsolete. (line 11) * profiling awk programs: Profiling. (line 6) * profiling awk programs, dynamically: Profiling. (line 171) @@ -27792,7 +27804,7 @@ Index * readable data files, checking: File Checking. (line 6) * readable.awk program: File Checking. (line 11) * recipe for a programming language: History. (line 6) -* record separators <1>: User-modified. (line 134) +* record separators <1>: User-modified. (line 143) * record separators: Records. (line 14) * record separators, changing: Records. (line 81) * record separators, regular expressions as: Records. (line 112) @@ -27874,10 +27886,11 @@ Index * right angle bracket (>), >> operator (I/O): Redirection. (line 50) * right shift, bitwise: Bitwise Functions. (line 32) * Ritchie, Dennis: Basic Data Typing. (line 74) -* RLENGTH variable: Auto-set. (line 183) +* RLENGTH variable: Auto-set. (line 200) * RLENGTH variable, match() function and: String Functions. (line 223) -* RNDMODE variable: Setting Rounding Mode. +* RNDMODE variable <1>: Setting Rounding Mode. (line 6) +* RNDMODE variable: User-modified. (line 138) * Robbins, Arnold <1>: Future Extensions. (line 6) * Robbins, Arnold <2>: Bugs. (line 32) * Robbins, Arnold <3>: Contributors. (line 108) @@ -27898,13 +27911,13 @@ Index * round() user-defined function: Round Function. (line 16) * rounding mode, floating-point: Rounding Mode. (line 6) * rounding numbers: Round Function. (line 6) -* RS variable <1>: User-modified. (line 134) +* RS variable <1>: User-modified. (line 143) * RS variable: Records. (line 20) * RS variable, multiline records and: Multiple Line. (line 17) * rshift() function (gawk): Bitwise Functions. (line 51) -* RSTART variable: Auto-set. (line 189) +* RSTART variable: Auto-set. (line 206) * RSTART variable, match() function and: String Functions. (line 223) -* RT variable <1>: Auto-set. (line 196) +* RT variable <1>: Auto-set. (line 213) * RT variable <2>: Getline/Variable/File. (line 10) * RT variable <3>: Multiple Line. (line 129) @@ -27947,11 +27960,11 @@ Index * separators, field, FIELDWIDTHS variable and: User-modified. (line 35) * separators, field, FPAT variable and: User-modified. (line 45) * separators, field, POSIX and: Fields. (line 6) -* separators, for records <1>: User-modified. (line 134) +* separators, for records <1>: User-modified. (line 143) * separators, for records: Records. (line 14) * separators, for records, regular expressions as: Records. (line 112) * separators, for statements in actions: Action Overview. (line 19) -* separators, subscript: User-modified. (line 147) +* separators, subscript: User-modified. (line 156) * set debugger command: Viewing And Changing Data. (line 59) * shells, piping commands into: Redirection. (line 143) @@ -28084,7 +28097,7 @@ Index (line 43) * sub() function, arguments of: String Functions. (line 462) * sub() function, escape processing: Gory Details. (line 6) -* subscript separators: User-modified. (line 147) +* subscript separators: User-modified. (line 156) * subscripts in arrays, multidimensional: Multi-dimensional. (line 10) * subscripts in arrays, multidimensional, scanning: Multi-scanning. (line 11) @@ -28092,7 +28105,7 @@ Index (line 6) * subscripts in arrays, uninitialized variables as: Uninitialized Subscripts. (line 6) -* SUBSEP variable: User-modified. (line 147) +* SUBSEP variable: User-modified. (line 156) * SUBSEP variable, multidimensional arrays: Multi-dimensional. (line 16) * substr() function: String Functions. (line 481) @@ -28125,7 +28138,7 @@ Index * text, printing: Print. (line 22) * text, printing, unduplicated lines of: Uniq Program. (line 6) * TEXTDOMAIN variable <1>: Programmer i18n. (line 9) -* TEXTDOMAIN variable: User-modified. (line 153) +* TEXTDOMAIN variable: User-modified. (line 162) * TEXTDOMAIN variable, BEGIN pattern and: Programmer i18n. (line 60) * TEXTDOMAIN variable, portability and: I18N Portability. (line 20) * textdomain() function (C library): Explaining gettext. (line 27) @@ -28394,399 +28407,399 @@ Node: When96117 Node: Invoking Gawk98264 Node: Command Line99649 Node: Options100432 -Ref: Options-Footnote-1114789 -Node: Other Arguments114814 -Node: Naming Standard Input117472 -Node: Environment Variables118566 -Node: AWKPATH Variable119010 -Ref: AWKPATH Variable-Footnote-1121607 -Node: Other Environment Variables121867 -Node: Exit Status124359 -Node: Include Files125034 -Node: Obsolete128519 -Node: Undocumented129205 -Node: Regexp129446 -Node: Regexp Usage130835 -Node: Escape Sequences132861 -Node: Regexp Operators138624 -Ref: Regexp Operators-Footnote-1145821 -Ref: Regexp Operators-Footnote-2145968 -Node: Bracket Expressions146066 -Ref: table-char-classes147956 -Node: GNU Regexp Operators150479 -Node: Case-sensitivity154202 -Ref: Case-sensitivity-Footnote-1157170 -Ref: Case-sensitivity-Footnote-2157405 -Node: Leftmost Longest157513 -Node: Computed Regexps158714 -Node: Reading Files162124 -Node: Records164128 -Ref: Records-Footnote-1172802 -Node: Fields172839 -Ref: Fields-Footnote-1175872 -Node: Nonconstant Fields175958 -Node: Changing Fields178160 -Node: Field Separators184141 -Node: Default Field Splitting186770 -Node: Regexp Field Splitting187887 -Node: Single Character Fields191229 -Node: Command Line Field Separator192288 -Node: Field Splitting Summary195729 -Ref: Field Splitting Summary-Footnote-1198921 -Node: Constant Size199022 -Node: Splitting By Content203606 -Ref: Splitting By Content-Footnote-1207332 -Node: Multiple Line207372 -Ref: Multiple Line-Footnote-1213219 -Node: Getline213398 -Node: Plain Getline215614 -Node: Getline/Variable217703 -Node: Getline/File218844 -Node: Getline/Variable/File220166 -Ref: Getline/Variable/File-Footnote-1221765 -Node: Getline/Pipe221852 -Node: Getline/Variable/Pipe224412 -Node: Getline/Coprocess225519 -Node: Getline/Variable/Coprocess226762 -Node: Getline Notes227476 -Node: Getline Summary229418 -Ref: table-getline-variants229761 -Node: Read Timeout230617 -Ref: Read Timeout-Footnote-1234362 -Node: Command line directories234419 -Node: Printing235049 -Node: Print236680 -Node: Print Examples238017 -Node: Output Separators240801 -Node: OFMT242561 -Node: Printf243919 -Node: Basic Printf244825 -Node: Control Letters246364 -Node: Format Modifiers250176 -Node: Printf Examples256185 -Node: Redirection258900 -Node: Special Files265884 -Node: Special FD266417 -Ref: Special FD-Footnote-1270042 -Node: Special Network270116 -Node: Special Caveats270966 -Node: Close Files And Pipes271762 -Ref: Close Files And Pipes-Footnote-1278785 -Ref: Close Files And Pipes-Footnote-2278933 -Node: Expressions279083 -Node: Values280215 -Node: Constants280891 -Node: Scalar Constants281571 -Ref: Scalar Constants-Footnote-1282430 -Node: Nondecimal-numbers282612 -Node: Regexp Constants285671 -Node: Using Constant Regexps286146 -Node: Variables289201 -Node: Using Variables289856 -Node: Assignment Options291580 -Node: Conversion293452 -Ref: table-locale-affects298828 -Ref: Conversion-Footnote-1299452 -Node: All Operators299561 -Node: Arithmetic Ops300191 -Node: Concatenation302696 -Ref: Concatenation-Footnote-1305489 -Node: Assignment Ops305609 -Ref: table-assign-ops310597 -Node: Increment Ops312005 -Node: Truth Values and Conditions315475 -Node: Truth Values316558 -Node: Typing and Comparison317607 -Node: Variable Typing318396 -Ref: Variable Typing-Footnote-1322293 -Node: Comparison Operators322415 -Ref: table-relational-ops322825 -Node: POSIX String Comparison326374 -Ref: POSIX String Comparison-Footnote-1327330 -Node: Boolean Ops327468 -Ref: Boolean Ops-Footnote-1331546 -Node: Conditional Exp331637 -Node: Function Calls333369 -Node: Precedence336963 -Node: Locales340632 -Node: Patterns and Actions341721 -Node: Pattern Overview342775 -Node: Regexp Patterns344444 -Node: Expression Patterns344987 -Node: Ranges348672 -Node: BEGIN/END351638 -Node: Using BEGIN/END352400 -Ref: Using BEGIN/END-Footnote-1355131 -Node: I/O And BEGIN/END355237 -Node: BEGINFILE/ENDFILE357519 -Node: Empty360412 -Node: Using Shell Variables360728 -Node: Action Overview363013 -Node: Statements365370 -Node: If Statement367224 -Node: While Statement368723 -Node: Do Statement370767 -Node: For Statement371923 -Node: Switch Statement375075 -Node: Break Statement377172 -Node: Continue Statement379162 -Node: Next Statement380955 -Node: Nextfile Statement383345 -Node: Exit Statement385890 -Node: Built-in Variables388306 -Node: User-modified389401 -Ref: User-modified-Footnote-1397427 -Node: Auto-set397489 -Ref: Auto-set-Footnote-1406780 -Node: ARGC and ARGV406985 -Node: Arrays410836 -Node: Array Basics412341 -Node: Array Intro413167 -Node: Reference to Elements417485 -Node: Assigning Elements419755 -Node: Array Example420246 -Node: Scanning an Array421978 -Node: Controlling Scanning424292 -Ref: Controlling Scanning-Footnote-1429225 -Node: Delete429541 -Ref: Delete-Footnote-1431976 -Node: Numeric Array Subscripts432033 -Node: Uninitialized Subscripts434216 -Node: Multi-dimensional435844 -Node: Multi-scanning438938 -Node: Arrays of Arrays440529 -Node: Functions445174 -Node: Built-in445996 -Node: Calling Built-in447074 -Node: Numeric Functions449062 -Ref: Numeric Functions-Footnote-1452827 -Ref: Numeric Functions-Footnote-2453184 -Ref: Numeric Functions-Footnote-3453232 -Node: String Functions453501 -Ref: String Functions-Footnote-1476998 -Ref: String Functions-Footnote-2477127 -Ref: String Functions-Footnote-3477375 -Node: Gory Details477462 -Ref: table-sub-escapes479141 -Ref: table-sub-posix-92480495 -Ref: table-sub-proposed481838 -Ref: table-posix-sub483188 -Ref: table-gensub-escapes484734 -Ref: Gory Details-Footnote-1485941 -Ref: Gory Details-Footnote-2485992 -Node: I/O Functions486143 -Ref: I/O Functions-Footnote-1492798 -Node: Time Functions492945 -Ref: Time Functions-Footnote-1503837 -Ref: Time Functions-Footnote-2503905 -Ref: Time Functions-Footnote-3504063 -Ref: Time Functions-Footnote-4504174 -Ref: Time Functions-Footnote-5504286 -Ref: Time Functions-Footnote-6504513 -Node: Bitwise Functions504779 -Ref: table-bitwise-ops505337 -Ref: Bitwise Functions-Footnote-1509497 -Node: Type Functions509681 -Node: I18N Functions510151 -Node: User-defined511778 -Node: Definition Syntax512582 -Ref: Definition Syntax-Footnote-1517492 -Node: Function Example517561 -Node: Function Caveats520155 -Node: Calling A Function520576 -Node: Variable Scope521691 -Node: Pass By Value/Reference523666 -Node: Return Statement527106 -Node: Dynamic Typing530087 -Node: Indirect Calls530822 -Node: Internationalization540507 -Node: I18N and L10N541946 -Node: Explaining gettext542632 -Ref: Explaining gettext-Footnote-1547698 -Ref: Explaining gettext-Footnote-2547882 -Node: Programmer i18n548047 -Node: Translator i18n552247 -Node: String Extraction553040 -Ref: String Extraction-Footnote-1554001 -Node: Printf Ordering554087 -Ref: Printf Ordering-Footnote-1556871 -Node: I18N Portability556935 -Ref: I18N Portability-Footnote-1559384 -Node: I18N Example559447 -Ref: I18N Example-Footnote-1562082 -Node: Gawk I18N562154 -Node: Arbitrary Precision Arithmetic562771 -Ref: Arbitrary Precision Arithmetic-Footnote-1565584 -Node: Floating-point Programming565725 -Node: Floating-point Representation570316 -Node: Floating-point Context571382 -Ref: table-ieee-formats572217 -Node: Rounding Mode573541 -Ref: table-rounding-modes574049 -Ref: Rounding Mode-Footnote-1577255 -Node: Arbitrary Precision Floats577436 -Ref: Arbitrary Precision Floats-Footnote-1579497 -Node: Setting Precision579799 -Node: Setting Rounding Mode582499 -Node: Floating-point Constants583402 -Node: Changing Precision584816 -Ref: Changing Precision-Footnote-1586199 -Node: Exact Arithmetic586369 -Node: Integer Programming589268 -Node: Arbitrary Precision Integers591014 -Node: MPFR and GMP Libraries593912 -Node: Advanced Features594561 -Node: Nondecimal Data596084 -Node: Array Sorting597667 -Node: Controlling Array Traversal598364 -Node: Array Sorting Functions606601 -Ref: Array Sorting Functions-Footnote-1610275 -Ref: Array Sorting Functions-Footnote-2610368 -Node: Two-way I/O610562 -Ref: Two-way I/O-Footnote-1615994 -Node: TCP/IP Networking616064 -Node: Profiling618908 -Node: Library Functions626362 -Ref: Library Functions-Footnote-1629369 -Node: Library Names629540 -Ref: Library Names-Footnote-1633011 -Ref: Library Names-Footnote-2633231 -Node: General Functions633317 -Node: Strtonum Function634270 -Node: Assert Function637200 -Node: Round Function640526 -Node: Cliff Random Function642069 -Node: Ordinal Functions643085 -Ref: Ordinal Functions-Footnote-1646155 -Ref: Ordinal Functions-Footnote-2646407 -Node: Join Function646616 -Ref: Join Function-Footnote-1648387 -Node: Gettimeofday Function648587 -Node: Data File Management652302 -Node: Filetrans Function652934 -Node: Rewind Function657073 -Node: File Checking658460 -Node: Empty Files659554 -Node: Ignoring Assigns661784 -Node: Getopt Function663337 -Ref: Getopt Function-Footnote-1674641 -Node: Passwd Functions674844 -Ref: Passwd Functions-Footnote-1683819 -Node: Group Functions683907 -Node: Walking Arrays691991 -Node: Sample Programs693560 -Node: Running Examples694225 -Node: Clones694953 -Node: Cut Program696177 -Node: Egrep Program706022 -Ref: Egrep Program-Footnote-1713795 -Node: Id Program713905 -Node: Split Program717521 -Ref: Split Program-Footnote-1721040 -Node: Tee Program721168 -Node: Uniq Program723971 -Node: Wc Program731400 -Ref: Wc Program-Footnote-1735666 -Ref: Wc Program-Footnote-2735866 -Node: Miscellaneous Programs735958 -Node: Dupword Program737146 -Node: Alarm Program739177 -Node: Translate Program743926 -Ref: Translate Program-Footnote-1748313 -Ref: Translate Program-Footnote-2748541 -Node: Labels Program748675 -Ref: Labels Program-Footnote-1752046 -Node: Word Sorting752130 -Node: History Sorting756014 -Node: Extract Program757853 -Ref: Extract Program-Footnote-1765336 -Node: Simple Sed765464 -Node: Igawk Program768526 -Ref: Igawk Program-Footnote-1783683 -Ref: Igawk Program-Footnote-2783884 -Node: Anagram Program784022 -Node: Signature Program787090 -Node: Debugger788190 -Node: Debugging789142 -Node: Debugging Concepts789575 -Node: Debugging Terms791431 -Node: Awk Debugging794028 -Node: Sample Debugging Session794920 -Node: Debugger Invocation795440 -Node: Finding The Bug796769 -Node: List of Debugger Commands803257 -Node: Breakpoint Control804591 -Node: Debugger Execution Control808255 -Node: Viewing And Changing Data811615 -Node: Execution Stack814971 -Node: Debugger Info816438 -Node: Miscellaneous Debugger Commands820419 -Node: Readline Support825864 -Node: Limitations826695 -Node: Language History828947 -Node: V7/SVR3.1830459 -Node: SVR4832780 -Node: POSIX834222 -Node: BTL835230 -Node: POSIX/GNU835964 -Node: Common Extensions841115 -Node: Ranges and Locales842222 -Ref: Ranges and Locales-Footnote-1846826 -Node: Contributors847047 -Node: Installation851308 -Node: Gawk Distribution852202 -Node: Getting852686 -Node: Extracting853512 -Node: Distribution contents855204 -Node: Unix Installation860426 -Node: Quick Installation861043 -Node: Additional Configuration Options863005 -Node: Configuration Philosophy864482 -Node: Non-Unix Installation866824 -Node: PC Installation867282 -Node: PC Binary Installation868581 -Node: PC Compiling870429 -Node: PC Testing873373 -Node: PC Using874549 -Node: Cygwin878734 -Node: MSYS879734 -Node: VMS Installation880248 -Node: VMS Compilation880851 -Ref: VMS Compilation-Footnote-1881858 -Node: VMS Installation Details881916 -Node: VMS Running883551 -Node: VMS Old Gawk885158 -Node: Bugs885632 -Node: Other Versions889484 -Node: Notes894799 -Node: Compatibility Mode895491 -Node: Additions896274 -Node: Accessing The Source897086 -Node: Adding Code898511 -Node: New Ports904478 -Node: Dynamic Extensions908591 -Node: Internals910031 -Node: Plugin License918550 -Node: Loading Extensions919188 -Node: Sample Library920998 -Node: Internal File Description921688 -Node: Internal File Ops925403 -Ref: Internal File Ops-Footnote-1930127 -Node: Using Internal File Ops930267 -Node: Future Extensions932644 -Node: Basic Concepts935148 -Node: Basic High Level935905 -Ref: Basic High Level-Footnote-1939940 -Node: Basic Data Typing940125 -Node: Floating Point Issues944650 -Node: String Conversion Precision945733 -Ref: String Conversion Precision-Footnote-1947433 -Node: Unexpected Results947542 -Node: POSIX Floating Point Problems949368 -Ref: POSIX Floating Point Problems-Footnote-1953073 -Node: Glossary953111 -Node: Copying978087 -Node: GNU Free Documentation License1015644 -Node: Index1040781 +Ref: Options-Footnote-1114802 +Node: Other Arguments114827 +Node: Naming Standard Input117485 +Node: Environment Variables118579 +Node: AWKPATH Variable119023 +Ref: AWKPATH Variable-Footnote-1121620 +Node: Other Environment Variables121880 +Node: Exit Status124372 +Node: Include Files125047 +Node: Obsolete128532 +Node: Undocumented129218 +Node: Regexp129459 +Node: Regexp Usage130848 +Node: Escape Sequences132874 +Node: Regexp Operators138637 +Ref: Regexp Operators-Footnote-1145834 +Ref: Regexp Operators-Footnote-2145981 +Node: Bracket Expressions146079 +Ref: table-char-classes147969 +Node: GNU Regexp Operators150492 +Node: Case-sensitivity154215 +Ref: Case-sensitivity-Footnote-1157183 +Ref: Case-sensitivity-Footnote-2157418 +Node: Leftmost Longest157526 +Node: Computed Regexps158727 +Node: Reading Files162137 +Node: Records164141 +Ref: Records-Footnote-1172815 +Node: Fields172852 +Ref: Fields-Footnote-1175885 +Node: Nonconstant Fields175971 +Node: Changing Fields178173 +Node: Field Separators184154 +Node: Default Field Splitting186783 +Node: Regexp Field Splitting187900 +Node: Single Character Fields191242 +Node: Command Line Field Separator192301 +Node: Field Splitting Summary195742 +Ref: Field Splitting Summary-Footnote-1198934 +Node: Constant Size199035 +Node: Splitting By Content203619 +Ref: Splitting By Content-Footnote-1207345 +Node: Multiple Line207385 +Ref: Multiple Line-Footnote-1213232 +Node: Getline213411 +Node: Plain Getline215627 +Node: Getline/Variable217716 +Node: Getline/File218857 +Node: Getline/Variable/File220179 +Ref: Getline/Variable/File-Footnote-1221778 +Node: Getline/Pipe221865 +Node: Getline/Variable/Pipe224425 +Node: Getline/Coprocess225532 +Node: Getline/Variable/Coprocess226775 +Node: Getline Notes227489 +Node: Getline Summary229431 +Ref: table-getline-variants229774 +Node: Read Timeout230630 +Ref: Read Timeout-Footnote-1234375 +Node: Command line directories234432 +Node: Printing235062 +Node: Print236693 +Node: Print Examples238030 +Node: Output Separators240814 +Node: OFMT242574 +Node: Printf243932 +Node: Basic Printf244838 +Node: Control Letters246377 +Node: Format Modifiers250189 +Node: Printf Examples256198 +Node: Redirection258913 +Node: Special Files265897 +Node: Special FD266430 +Ref: Special FD-Footnote-1270055 +Node: Special Network270129 +Node: Special Caveats270979 +Node: Close Files And Pipes271775 +Ref: Close Files And Pipes-Footnote-1278798 +Ref: Close Files And Pipes-Footnote-2278946 +Node: Expressions279096 +Node: Values280228 +Node: Constants280904 +Node: Scalar Constants281584 +Ref: Scalar Constants-Footnote-1282443 +Node: Nondecimal-numbers282625 +Node: Regexp Constants285684 +Node: Using Constant Regexps286159 +Node: Variables289214 +Node: Using Variables289869 +Node: Assignment Options291593 +Node: Conversion293465 +Ref: table-locale-affects298841 +Ref: Conversion-Footnote-1299465 +Node: All Operators299574 +Node: Arithmetic Ops300204 +Node: Concatenation302709 +Ref: Concatenation-Footnote-1305502 +Node: Assignment Ops305622 +Ref: table-assign-ops310610 +Node: Increment Ops312018 +Node: Truth Values and Conditions315488 +Node: Truth Values316571 +Node: Typing and Comparison317620 +Node: Variable Typing318409 +Ref: Variable Typing-Footnote-1322306 +Node: Comparison Operators322428 +Ref: table-relational-ops322838 +Node: POSIX String Comparison326387 +Ref: POSIX String Comparison-Footnote-1327343 +Node: Boolean Ops327481 +Ref: Boolean Ops-Footnote-1331559 +Node: Conditional Exp331650 +Node: Function Calls333382 +Node: Precedence336976 +Node: Locales340645 +Node: Patterns and Actions341734 +Node: Pattern Overview342788 +Node: Regexp Patterns344457 +Node: Expression Patterns345000 +Node: Ranges348685 +Node: BEGIN/END351651 +Node: Using BEGIN/END352413 +Ref: Using BEGIN/END-Footnote-1355144 +Node: I/O And BEGIN/END355250 +Node: BEGINFILE/ENDFILE357532 +Node: Empty360425 +Node: Using Shell Variables360741 +Node: Action Overview363026 +Node: Statements365383 +Node: If Statement367237 +Node: While Statement368736 +Node: Do Statement370780 +Node: For Statement371936 +Node: Switch Statement375088 +Node: Break Statement377185 +Node: Continue Statement379175 +Node: Next Statement380968 +Node: Nextfile Statement383358 +Node: Exit Statement385903 +Node: Built-in Variables388319 +Node: User-modified389414 +Ref: User-modified-Footnote-1397765 +Node: Auto-set397827 +Ref: Auto-set-Footnote-1407673 +Node: ARGC and ARGV407878 +Node: Arrays411729 +Node: Array Basics413234 +Node: Array Intro414060 +Node: Reference to Elements418378 +Node: Assigning Elements420648 +Node: Array Example421139 +Node: Scanning an Array422871 +Node: Controlling Scanning425185 +Ref: Controlling Scanning-Footnote-1430118 +Node: Delete430434 +Ref: Delete-Footnote-1432869 +Node: Numeric Array Subscripts432926 +Node: Uninitialized Subscripts435109 +Node: Multi-dimensional436737 +Node: Multi-scanning439831 +Node: Arrays of Arrays441422 +Node: Functions446067 +Node: Built-in446889 +Node: Calling Built-in447967 +Node: Numeric Functions449955 +Ref: Numeric Functions-Footnote-1453720 +Ref: Numeric Functions-Footnote-2454077 +Ref: Numeric Functions-Footnote-3454125 +Node: String Functions454394 +Ref: String Functions-Footnote-1477891 +Ref: String Functions-Footnote-2478020 +Ref: String Functions-Footnote-3478268 +Node: Gory Details478355 +Ref: table-sub-escapes480034 +Ref: table-sub-posix-92481388 +Ref: table-sub-proposed482731 +Ref: table-posix-sub484081 +Ref: table-gensub-escapes485627 +Ref: Gory Details-Footnote-1486834 +Ref: Gory Details-Footnote-2486885 +Node: I/O Functions487036 +Ref: I/O Functions-Footnote-1493691 +Node: Time Functions493838 +Ref: Time Functions-Footnote-1504730 +Ref: Time Functions-Footnote-2504798 +Ref: Time Functions-Footnote-3504956 +Ref: Time Functions-Footnote-4505067 +Ref: Time Functions-Footnote-5505179 +Ref: Time Functions-Footnote-6505406 +Node: Bitwise Functions505672 +Ref: table-bitwise-ops506230 +Ref: Bitwise Functions-Footnote-1510390 +Node: Type Functions510574 +Node: I18N Functions511044 +Node: User-defined512671 +Node: Definition Syntax513475 +Ref: Definition Syntax-Footnote-1518385 +Node: Function Example518454 +Node: Function Caveats521048 +Node: Calling A Function521469 +Node: Variable Scope522584 +Node: Pass By Value/Reference524559 +Node: Return Statement527999 +Node: Dynamic Typing530980 +Node: Indirect Calls531715 +Node: Internationalization541400 +Node: I18N and L10N542839 +Node: Explaining gettext543525 +Ref: Explaining gettext-Footnote-1548591 +Ref: Explaining gettext-Footnote-2548775 +Node: Programmer i18n548940 +Node: Translator i18n553140 +Node: String Extraction553933 +Ref: String Extraction-Footnote-1554894 +Node: Printf Ordering554980 +Ref: Printf Ordering-Footnote-1557764 +Node: I18N Portability557828 +Ref: I18N Portability-Footnote-1560277 +Node: I18N Example560340 +Ref: I18N Example-Footnote-1562975 +Node: Gawk I18N563047 +Node: Arbitrary Precision Arithmetic563664 +Ref: Arbitrary Precision Arithmetic-Footnote-1566476 +Node: Floating-point Programming566617 +Node: Floating-point Representation571208 +Node: Floating-point Context572274 +Ref: table-ieee-formats573109 +Node: Rounding Mode574433 +Ref: table-rounding-modes574941 +Ref: Rounding Mode-Footnote-1578147 +Node: Arbitrary Precision Floats578328 +Ref: Arbitrary Precision Floats-Footnote-1580402 +Node: Setting Precision580704 +Node: Setting Rounding Mode583404 +Node: Floating-point Constants584307 +Node: Changing Precision585721 +Ref: Changing Precision-Footnote-1587104 +Node: Exact Arithmetic587274 +Node: Integer Programming590172 +Node: Arbitrary Precision Integers591918 +Node: MPFR and GMP Libraries594827 +Node: Advanced Features595190 +Node: Nondecimal Data596713 +Node: Array Sorting598296 +Node: Controlling Array Traversal598993 +Node: Array Sorting Functions607230 +Ref: Array Sorting Functions-Footnote-1610904 +Ref: Array Sorting Functions-Footnote-2610997 +Node: Two-way I/O611191 +Ref: Two-way I/O-Footnote-1616623 +Node: TCP/IP Networking616693 +Node: Profiling619537 +Node: Library Functions626991 +Ref: Library Functions-Footnote-1629998 +Node: Library Names630169 +Ref: Library Names-Footnote-1633640 +Ref: Library Names-Footnote-2633860 +Node: General Functions633946 +Node: Strtonum Function634899 +Node: Assert Function637829 +Node: Round Function641155 +Node: Cliff Random Function642698 +Node: Ordinal Functions643714 +Ref: Ordinal Functions-Footnote-1646784 +Ref: Ordinal Functions-Footnote-2647036 +Node: Join Function647245 +Ref: Join Function-Footnote-1649016 +Node: Gettimeofday Function649216 +Node: Data File Management652931 +Node: Filetrans Function653563 +Node: Rewind Function657702 +Node: File Checking659089 +Node: Empty Files660183 +Node: Ignoring Assigns662413 +Node: Getopt Function663966 +Ref: Getopt Function-Footnote-1675270 +Node: Passwd Functions675473 +Ref: Passwd Functions-Footnote-1684448 +Node: Group Functions684536 +Node: Walking Arrays692620 +Node: Sample Programs694189 +Node: Running Examples694854 +Node: Clones695582 +Node: Cut Program696806 +Node: Egrep Program706651 +Ref: Egrep Program-Footnote-1714424 +Node: Id Program714534 +Node: Split Program718150 +Ref: Split Program-Footnote-1721669 +Node: Tee Program721797 +Node: Uniq Program724600 +Node: Wc Program732029 +Ref: Wc Program-Footnote-1736295 +Ref: Wc Program-Footnote-2736495 +Node: Miscellaneous Programs736587 +Node: Dupword Program737775 +Node: Alarm Program739806 +Node: Translate Program744555 +Ref: Translate Program-Footnote-1748942 +Ref: Translate Program-Footnote-2749170 +Node: Labels Program749304 +Ref: Labels Program-Footnote-1752675 +Node: Word Sorting752759 +Node: History Sorting756643 +Node: Extract Program758482 +Ref: Extract Program-Footnote-1765965 +Node: Simple Sed766093 +Node: Igawk Program769155 +Ref: Igawk Program-Footnote-1784312 +Ref: Igawk Program-Footnote-2784513 +Node: Anagram Program784651 +Node: Signature Program787719 +Node: Debugger788819 +Node: Debugging789771 +Node: Debugging Concepts790204 +Node: Debugging Terms792060 +Node: Awk Debugging794657 +Node: Sample Debugging Session795549 +Node: Debugger Invocation796069 +Node: Finding The Bug797398 +Node: List of Debugger Commands803886 +Node: Breakpoint Control805220 +Node: Debugger Execution Control808884 +Node: Viewing And Changing Data812244 +Node: Execution Stack815600 +Node: Debugger Info817067 +Node: Miscellaneous Debugger Commands821048 +Node: Readline Support826493 +Node: Limitations827324 +Node: Language History829576 +Node: V7/SVR3.1831088 +Node: SVR4833409 +Node: POSIX834851 +Node: BTL835859 +Node: POSIX/GNU836593 +Node: Common Extensions841744 +Node: Ranges and Locales842851 +Ref: Ranges and Locales-Footnote-1847455 +Node: Contributors847676 +Node: Installation851937 +Node: Gawk Distribution852831 +Node: Getting853315 +Node: Extracting854141 +Node: Distribution contents855833 +Node: Unix Installation861055 +Node: Quick Installation861672 +Node: Additional Configuration Options863634 +Node: Configuration Philosophy865111 +Node: Non-Unix Installation867453 +Node: PC Installation867911 +Node: PC Binary Installation869210 +Node: PC Compiling871058 +Node: PC Testing874002 +Node: PC Using875178 +Node: Cygwin879363 +Node: MSYS880363 +Node: VMS Installation880877 +Node: VMS Compilation881480 +Ref: VMS Compilation-Footnote-1882487 +Node: VMS Installation Details882545 +Node: VMS Running884180 +Node: VMS Old Gawk885787 +Node: Bugs886261 +Node: Other Versions890113 +Node: Notes895428 +Node: Compatibility Mode896120 +Node: Additions896903 +Node: Accessing The Source897715 +Node: Adding Code899140 +Node: New Ports905107 +Node: Dynamic Extensions909220 +Node: Internals910660 +Node: Plugin License919179 +Node: Loading Extensions919817 +Node: Sample Library921627 +Node: Internal File Description922317 +Node: Internal File Ops926032 +Ref: Internal File Ops-Footnote-1930756 +Node: Using Internal File Ops930896 +Node: Future Extensions933273 +Node: Basic Concepts935777 +Node: Basic High Level936534 +Ref: Basic High Level-Footnote-1940569 +Node: Basic Data Typing940754 +Node: Floating Point Issues945279 +Node: String Conversion Precision946362 +Ref: String Conversion Precision-Footnote-1948062 +Node: Unexpected Results948171 +Node: POSIX Floating Point Problems949997 +Ref: POSIX Floating Point Problems-Footnote-1953702 +Node: Glossary953740 +Node: Copying978716 +Node: GNU Free Documentation License1016273 +Node: Index1041410 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 2d68b9cc..c8a0db6b 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -3229,9 +3229,9 @@ care to search for all occurrences of each inappropriate construct. As @command{awk} programs are usually short, doing so is not burdensome. @item -M -@itemx --bcmath +@itemx --arbitrary-precision @cindex @code{-M} option -@cindex @code{--bcmath} option +@cindex @code{--arbitrary-precision} option Force arbitrary precision arithmetic on numbers. This option has no effect if @command{gawk} is not compiled to use the GNU MPFR and MP libraries (@pxref{Arbitrary Precision Arithmetic}). @@ -12624,6 +12624,17 @@ This is the output record separator. It is output at the end of every @code{print} statement. Its default value is @code{"\n"}, the newline character. (@xref{Output Separators}.) +@cindex @code{PREC} variable +@item PREC # +The working precision of arbitrary precision floating-point numbers, +53 by default. (@xref{Setting Precision}.) + +@cindex @code{RNDMODE} variable +@item RNDMODE # +The rounding mode to use for arbitrary precision arithmetic on +numbers, by default @code{"N"} (@samp{roundTiesToEven} in IEEE-754 standard). +(@xref{Setting Rounding Mode}.) + @cindex @code{RS} variable @cindex separators, for records @cindex record separators @@ -12907,6 +12918,25 @@ The value of the @code{getuid()} system call. The version of @command{gawk}. @end table +The following additional elements in the array +are available to provide information about the MPFR and GMP libraries +if your version of @command{gawk} supports arbitrary precision numbers +(@pxref{Arbitrary Precision Arithmetic}): + +@table @code +@item PROCINFO["mpfr_version"] +The version of the GNU MPFR library. + +@item PROCINFO["gmp_version"] +The version of the GNU MP library. + +@item PROCINFO["prec_max"] +The maximum precision supported by MPFR. + +@item PROCINFO["prec_min"] +The minimum precision required by MPFR. +@end table + On some systems, there may be elements in the array, @code{"group1"} through @code{"group@var{N}"} for some @var{N}. @var{N} is the number of supplementary groups that the process has. Use the @code{in} operator @@ -18380,7 +18410,7 @@ in general, and the limitations of doing arithmetic with ordinary * Changing Precision:: Changing the Precision of a Number. * Exact Arithmetic:: Exact Arithmetic with Floating-point Numbers. * Integer Programming:: Effective Integer Programming. -* Arbitrary Precision Integers:: Arbitrary Precision Integer. +* Arbitrary Precision Integers:: Arbitrary Precision Integer Arithmetic with @command{gawk}. * MPFR and GMP Libraries:: Information About the MPFR and GMP Libraries. @end menu @@ -18535,7 +18565,7 @@ Precision of the floating-point format in bits. Maximum exponent allowed for this format. @item emin Minimum exponent allowed for this format. -@item subnormal behavior +@item underflow behavior The format may or may not support gradual underflow. @item rounding The rounding mode of this context. @@ -18675,7 +18705,7 @@ when you change the rounding mode. Gawk uses the GNU MPFR library for arbitrary precision floating-point arithmetic. The MPFR library provides precise control over precisions and rounding modes, and gives correctly rounded reproducible platform-independent results. -With the command-line option @option{--bcmath} or @option{-M}, all floating-point +With the command-line option @option{--arbitrary-precision} or @option{-M}, all floating-point arithmetic operators and numeric functions can yield results to any desired precision level supported by MPFR. Two built-in variables @code{PREC} (@pxref{Setting Precision}) @@ -18872,7 +18902,7 @@ no easy answers. The standard rules of algebra often do not apply when using floating-point arithmetic. Among other things, the distributive and associative laws do not hold completely, and order of operation may be important -for your computation. Rounding error, cumulative precision loss, +for your computation. Rounding error, cumulative precision loss and underflow are often troublesome. When @command{gawk} tests the expressions 0.1 + 12.2 and 12.3 for equality @@ -18964,7 +18994,7 @@ your terminal screen. @section Arbitrary Precision Integer Arithmetic with @command{gawk} @cindex integer, arbitrary precision -If the option @option{--bcmath} or @option{-M} is specified, @command{gawk} will perform all +If the option @option{--arbitrary-precision} or @option{-M} is specified, @command{gawk} will perform all integer arithmetic using GMP arbitrary precision integers. Any number that looks like an integer in a program source or data file will be stored as an arbitrary precision integer. @@ -19040,24 +19070,10 @@ $ @kbd{gawk -M 'BEGIN @{ n = 13; print n % 2 @}'} @node MPFR and GMP Libraries @section Information About the MPFR and GMP Libraries -@cindex @code{PROCINFO} array -The following elements of the PROCINFO array (@pxref{Built-in Variables}) -are available to provide information about the MPFR and GMP libraries: - -@table @code -@item PROCINFO["mpfr_version"] -The version of the GNU MPFR library. - -@item PROCINFO["gmp_version"] -The version of the GNU MP library. - -@item PROCINFO["prec_max"] -The maximum precision supported by MPFR. - -@item PROCINFO["prec_min"] -The minimum precision required by MPFR. -@end table +There are few elements available in the @code{PROCINFO} array +to provide information about the MPFR and GMP libraries. +(@xref{Auto-set}.) @node Advanced Features @@ -134,10 +134,10 @@ #ifdef HAVE_MPFR /* increment NR or FNR */ -#define INCREMENT_R(X) (do_mpfr && X == (LONG_MAX - 1)) ? \ +#define INCREMENT_REC(X) (do_mpfr && X == (LONG_MAX - 1)) ? \ (mpz_add_ui(M##X, M##X, 1), X = 0) : X++ #else -#define INCREMENT_R(X) X++ +#define INCREMENT_REC(X) X++ #endif typedef enum { CLOSE_ALL, CLOSE_TO, CLOSE_FROM } two_way_close_type; @@ -494,8 +494,8 @@ inrec(IOBUF *iop, int *errcode) if (*errcode > 0) update_ERRNO_saved(*errcode); } else { - INCREMENT_R(NR); - INCREMENT_R(FNR); + INCREMENT_REC(NR); + INCREMENT_REC(FNR); set_record(begin, cnt); } @@ -2326,8 +2326,8 @@ do_getline(int intovar, IOBUF *iop) if (cnt == EOF) return NULL; /* try next file */ - INCREMENT_R(NR); - INCREMENT_R(FNR); + INCREMENT_REC(NR); + INCREMENT_REC(FNR); if (! intovar) /* no optional var. */ set_record(s, cnt); diff --git a/m4/ChangeLog b/m4/ChangeLog index 8aaeb418..22dc64dc 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,6 @@ +2012-04-01 John Haque <j.eh@mchsi.com> + * mpfr.m4: New file. + 2011-06-23 Arnold D. Robbins <arnold@skeeve.com> * ChangeLog.0: Rotated ChangeLog into this file. @@ -191,7 +191,7 @@ static const struct option optab[] = { { "use-lc-numeric", no_argument, & use_lc_numeric, 1 }, { "characters-as-bytes", no_argument, & do_binary, 'b' }, { "sandbox", no_argument, NULL, 'S' }, - { "bcmath", no_argument, NULL, 'M' }, + { "arbitrary-precision",no_argument, NULL, 'M' }, #if defined(YYDEBUG) || defined(GAWKDEBUG) { "parsedebug", no_argument, NULL, 'Y' }, #endif @@ -787,7 +787,7 @@ usage(int exitval, FILE *fp) fputs(_("\t-l library\t\t--load=library\n"), fp); fputs(_("\t-L [fatal]\t\t--lint[=fatal]\n"), fp); fputs(_("\t-n\t\t\t--non-decimal-data\n"), fp); - fputs(_("\t-M\t\t\t--bcmath\n"), fp); + fputs(_("\t-M\t\t\t--arbitrary-precision\n"), fp); fputs(_("\t-N\t\t\t--use-lc-numeric\n"), fp); fputs(_("\t-o[file]\t\t--pretty-print[=file]\n"), fp); fputs(_("\t-O\t\t\t--optimize\n"), fp); diff --git a/test/ChangeLog b/test/ChangeLog index 8dbd225a..773c5ae6 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,14 @@ +2012-04-01 John Haque <j.eh@mchsi.com> + + * Makefile.am (mpfr-test): Add target for manual testing of MPFR + and GMP numbers. + * mpfrbigint.awk, mpfrexprange.awk, mpfrieee.awk, mpfrnr.awk, + mpfrrnd.awk, mpfrsort.awk: New tests. + (MPFR_TESTS): Add the new tests. + * mpfrnr.in, mpfrbigint.ok, mpfrexprange.ok, mpfrieee.ok, mpfrnr.ok, + mpfrrnd.ok, mpfrsort.ok: New files. + (AWK): Add AWKFLAGS; useful for testing with 'gawk -M' invocation. + 2012-02-28 Arnold D. Robbins <arnold@skeeve.com> * fmtspcl-mpfr.ok, fnarydel-mpfr.ok, fnparydl-mpfr.ok, diff --git a/test/badargs.ok b/test/badargs.ok index fd0a823f..3dd65990 100644 --- a/test/badargs.ok +++ b/test/badargs.ok @@ -18,7 +18,7 @@ Short options: GNU long options: (extensions) -l library --load=library -L [fatal] --lint[=fatal] -n --non-decimal-data - -M --bcmath + -M --arbitrary-precision -N --use-lc-numeric -o[file] --pretty-print[=file] -O --optimize |