[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-582
From: |
Arnold Robbins |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-582-g1f6b16d |
Date: |
Sun, 08 Feb 2015 18:50:59 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk-4.1-stable has been updated
via 1f6b16d2d233ecc7f99ea2460098d8eeec382942 (commit)
from efbd4b724d239fa3c2d2929dc50e4bb4703489b9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=1f6b16d2d233ecc7f99ea2460098d8eeec382942
commit 1f6b16d2d233ecc7f99ea2460098d8eeec382942
Author: Arnold D. Robbins <address@hidden>
Date: Sun Feb 8 20:50:31 2015 +0200
O'Reilly fixes. Through chapter 15.
diff --git a/doc/gawk.info b/doc/gawk.info
index 5bfdd43..c56ac89 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -21768,7 +21768,7 @@ Decimal arithmetic
sides) of the decimal point, and the results of a computation are
always exact.
- Some modern system can do decimal arithmetic in hardware, but
+ Some modern systems can do decimal arithmetic in hardware, but
usually you need a special software library to provide access to
these instructions. There are also libraries that do decimal
arithmetic entirely in software.
@@ -21822,12 +21822,6 @@ Numeric representation Minimum value
Maximum value
32-bit unsigned integer 0 4,294,967,295
64-bit signed integer -9,223,372,036,854,775,8089,223,372,036,854,775,807
64-bit unsigned integer 0 18,446,744,073,709,551,615
-Single-precision `1.175494e-38' `3.402823e+38'
-floating point
-(approximate)
-Double-precision `2.225074e-308' `1.797693e+308'
-floating point
-(approximate)
Table 15.1: Value ranges for different numeric representations
@@ -21843,7 +21837,7 @@ File: gawk.info, Node: Math Definitions, Next: MPFR
features, Prev: Computer
The rest of this major node uses a number of terms. Here are some
informal definitions that should help you work your way through the
-material here.
+material here:
"Accuracy"
A floating-point calculation's accuracy is how close it comes to
@@ -21863,7 +21857,7 @@ material here.
number and infinity produce infinity.
"NaN"
- "Not A Number."(1) A special value that results from attempting a
+ "Not a number."(1) A special value that results from attempting a
calculation that has no answer as a real number. In such a case,
programs can either receive a floating-point exception, or get
`NaN' back as the result. The IEEE 754 standard recommends that
@@ -21889,15 +21883,15 @@ material here.
PREC = 3.322 * DPS
- Here, PREC denotes the binary precision (measured in bits) and DPS
- (short for decimal places) is the decimal digits.
+ Here, _prec_ denotes the binary precision (measured in bits) and
+ _dps_ (short for decimal places) is the decimal digits.
"Rounding mode"
How numbers are rounded up or down when necessary. More details
are provided later.
"Significand"
- A floating-point value consists the significand multiplied by 10
+ A floating-point value consists of the significand multiplied by 10
to the power of the exponent. For example, in `1.2345e67', the
significand is `1.2345'.
@@ -21919,7 +21913,7 @@ precision formats to allow greater precisions and
larger exponent
ranges. (`awk' uses only the 64-bit double-precision format.)
*note table-ieee-formats:: lists the precision and exponent field
-values for the basic IEEE 754 binary formats:
+values for the basic IEEE 754 binary formats.
Name Total bits Precision Minimum Maximum
exponent exponent
@@ -21984,7 +21978,7 @@ File: gawk.info, Node: FP Math Caution, Next:
Arbitrary Precision Integers, P
Math class is tough! -- Teen Talk Barbie, July 1992
- This minor node provides a high level overview of the issues
+ This minor node provides a high-level overview of the issues
involved when doing lots of floating-point arithmetic.(1) The
discussion applies to both hardware and arbitrary-precision
floating-point arithmetic.
@@ -22005,8 +21999,8 @@ floating-point arithmetic.
(1) There is a very nice paper on floating-point arithmetic
(http://www.validlab.com/goldberg/paper.pdf) by David Goldberg, "What
-Every Computer Scientist Should Know About Floating-point Arithmetic,"
-`ACM Computing Surveys' *23*, 1 (1991-03), 5-48. This is worth reading
+Every Computer Scientist Should Know About Floating-Point Arithmetic,"
+`ACM Computing Surveys' *23*, 1 (1991-03): 5-48. This is worth reading
if you are interested in the details, but it does require a background
in computer science.
@@ -22060,7 +22054,7 @@ number as you assigned to it:
Often the error is so small you do not even notice it, and if you do,
you can always specify how much precision you would like in your output.
-Usually this is a format string like `"%.15g"', which when used in the
+Usually this is a format string like `"%.15g"', which, when used in the
previous example, produces an output identical to the input.
@@ -22100,7 +22094,7 @@ File: gawk.info, Node: Errors accumulate, Prev:
Comparing FP Values, Up: Inex
The loss of accuracy during a single computation with floating-point
numbers usually isn't enough to worry about. However, if you compute a
-value which is the result of a sequence of floating-point operations,
+value that is the result of a sequence of floating-point operations,
the error can accumulate and greatly affect the computation itself.
Here is an attempt to compute the value of pi using one of its many
series representations:
@@ -22151,7 +22145,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
@@ -22186,8 +22180,9 @@ illustrated by our earlier attempt to compute the value
of pi. Extra
precision can greatly enhance the stability and the accuracy of your
computation in such cases.
- Repeated addition is not necessarily equivalent to multiplication in
-floating-point arithmetic. In the example in *note Errors accumulate:::
+ Additionally, you should understand that repeated addition is not
+necessarily equivalent to multiplication in floating-point arithmetic.
+In the example in *note Errors accumulate:::
$ gawk 'BEGIN {
> for (d = 1.1; d <= 1.5; d += 0.1) # loop five times (?)
@@ -22242,7 +22237,7 @@ set the value to one of the predefined case-insensitive
strings shown
in *note table-predefined-precision-strings::, to emulate an IEEE 754
binary format.
-`PREC' IEEE 754 Binary Format
+`PREC' IEEE 754 binary format
---------------------------------------------------
`"half"' 16-bit half-precision
`"single"' Basic 32-bit single precision
@@ -22275,14 +22270,14 @@ on arithmetic operations:
example illustrates the differences among various ways to print a
floating-point constant:
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
- -| 0.1000000000000000055511151
- $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }'
- -| 0.1000000000000000000000000
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
- -| 0.1000000000000000000000000
- $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
- -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 0.1) }'
+ -| 0.1000000000000000055511151
+ $ gawk -M -v PREC=113 'BEGIN { printf("%0.25f\n", 0.1) }'
+ -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", "0.1") }'
+ -| 0.1000000000000000000000000
+ $ gawk -M 'BEGIN { PREC = 113; printf("%0.25f\n", 1/10) }'
+ -| 0.1000000000000000000000000
File: gawk.info, Node: Setting the rounding mode, Prev: Setting precision,
Up: FP Math Caution
@@ -22290,15 +22285,15 @@ File: gawk.info, Node: Setting the rounding mode,
Prev: Setting precision, Up
15.4.5 Setting the Rounding Mode
--------------------------------
-The `ROUNDMODE' variable provides program level control over the
+The `ROUNDMODE' variable provides program-level control over the
rounding mode. The correspondence between `ROUNDMODE' and the IEEE
rounding modes is shown in *note table-gawk-rounding-modes::.
-Rounding Mode IEEE Name `ROUNDMODE'
+Rounding mode IEEE name `ROUNDMODE'
---------------------------------------------------------------------------
Round to nearest, ties to even `roundTiesToEven' `"N"' or `"n"'
-Round toward plus Infinity `roundTowardPositive' `"U"' or `"u"'
-Round toward negative Infinity `roundTowardNegative' `"D"' or `"d"'
+Round toward positive infinity `roundTowardPositive' `"U"' or `"u"'
+Round toward negative infinity `roundTowardNegative' `"D"' or `"d"'
Round toward zero `roundTowardZero' `"Z"' or `"z"'
Round to nearest, ties away `roundTiesToAway' `"A"' or `"a"'
from zero
@@ -22349,8 +22344,8 @@ distributes upward and downward rounds of exact halves,
which might
cause any accumulating round-off error to cancel itself out. This is the
default rounding mode for IEEE 754 computing functions and operators.
- The other rounding modes are rarely used. Round toward positive
-infinity (`roundTowardPositive') and round toward negative infinity
+ The other rounding modes are rarely used. Rounding toward positive
+infinity (`roundTowardPositive') and toward negative infinity
(`roundTowardNegative') are often used to implement interval
arithmetic, where you adjust the rounding mode to calculate upper and
lower bounds for the range of output. The `roundTowardZero' mode can be
@@ -22398,7 +22393,7 @@ floating-point values:
If instead you were to compute the same value using
arbitrary-precision floating-point values, the precision needed for
-correct output (using the formula `prec = 3.322 * dps'), would be 3.322
+correct output (using the formula `prec = 3.322 * dps') would be 3.322
x 183231, or 608693.
The result from an arithmetic operation with an integer and a
@@ -22429,7 +22424,7 @@ interface to process arbitrary-precision integers or
mixed-mode numbers
as needed by an operation or function. In such a case, the precision is
set to the minimum value necessary for exact conversion, and the working
precision is not used for this purpose. If this is not what you need or
-want, you can employ a subterfuge, and convert the integer to floating
+want, you can employ a subterfuge and convert the integer to floating
point first, like this:
gawk -M 'BEGIN { n = 13; print (n + 0.0) % 2.0 }'
@@ -22456,7 +22451,7 @@ File: gawk.info, Node: POSIX Floating Point Problems,
Next: Floating point sum
15.6 Standards Versus Existing Practice
=======================================
-Historically, `awk' has converted any non-numeric looking string to the
+Historically, `awk' has converted any nonnumeric-looking string to the
numeric value zero, when required. Furthermore, the original
definition of the language and the original POSIX standards specified
that `awk' only understands decimal numbers (base 10), and not octal
@@ -22470,8 +22465,8 @@ These features are:
hexadecimal notation (e.g., `0xDEADBEEF'). (Note: data values,
_not_ source code constants.)
- * Support for the special IEEE 754 floating-point values "Not A
- Number" (NaN), positive Infinity ("inf"), and negative Infinity
+ * Support for the special IEEE 754 floating-point values "not a
+ number" (NaN), positive infinity ("inf"), and negative infinity
("-inf"). In particular, the format for these values is as
specified by the ISO 1999 C standard, which ignores case and can
allow implementation-dependent additional characters after the
@@ -22488,21 +22483,21 @@ historical practice:
values is also a very severe departure from historical practice.
The second problem is that the `gawk' maintainer feels that this
-interpretation of the standard, which requires a certain amount of
+interpretation of the standard, which required a certain amount of
"language lawyering" to arrive at in the first place, was not even
-intended by the standard developers. In other words, "we see how you
+intended by the standard developers. In other words, "We see how you
got where you are, but we don't think that that's where you want to be."
Recognizing these issues, but attempting to provide compatibility
with the earlier versions of the standard, the 2008 POSIX standard
added explicit wording to allow, but not require, that `awk' support
-hexadecimal floating-point values and special values for "Not A Number"
+hexadecimal floating-point values and special values for "not a number"
and infinity.
Although the `gawk' maintainer continues to feel that providing
those features is inadvisable, nevertheless, on systems that support
IEEE floating point, it seems reasonable to provide _some_ way to
-support NaN and Infinity values. The solution implemented in `gawk' is
+support NaN and infinity values. The solution implemented in `gawk' is
as follows:
* With the `--posix' command-line option, `gawk' becomes "hands
@@ -22517,7 +22512,7 @@ as follows:
$ echo 0xDeadBeef | gawk --posix '{ print $1 + 0 }'
-| 3735928559
- * Without `--posix', `gawk' interprets the four strings `+inf',
+ * Without `--posix', `gawk' interprets the four string values `+inf',
`-inf', `+nan', and `-nan' specially, producing the corresponding
special numeric values. The leading sign acts a signal to `gawk'
(and the user) that the value is really numeric. Hexadecimal
@@ -22531,7 +22526,7 @@ as follows:
$ echo 0xDeadBeef | gawk '{ print $1 + 0 }'
-| 0
- `gawk' ignores case in the four special values. Thus `+nan' and
+ `gawk' ignores case in the four special values. Thus, `+nan' and
`+NaN' are the same.
---------- Footnotes ----------
@@ -22548,9 +22543,9 @@ File: gawk.info, Node: Floating point summary, Prev:
POSIX Floating Point Prob
floating-point values. Standard `awk' uses double-precision
floating-point values.
- * In the early 1990s, Barbie mistakenly said "Math class is tough!"
+ * In the early 1990s Barbie mistakenly said, "Math class is tough!"
Although math isn't tough, floating-point arithmetic isn't the same
- as pencil and paper math, and care must be taken:
+ as pencil-and-paper math, and care must be taken:
- Not all numbers can be represented exactly.
@@ -22571,7 +22566,7 @@ File: gawk.info, Node: Floating point summary, Prev:
POSIX Floating Point Prob
rounding mode.
* With `-M', `gawk' performs arbitrary-precision integer arithmetic
- using the GMP library. This is faster and more space efficient
+ using the GMP library. This is faster and more space-efficient
than using MPFR for the same calculations.
* There are several "dark corners" with respect to floating-point
@@ -22582,7 +22577,7 @@ File: gawk.info, Node: Floating point summary, Prev:
POSIX Floating Point Prob
results from floating-point arithmetic. The lesson to remember is
that floating-point arithmetic is always more complex than
arithmetic using pencil and paper. In order to take advantage of
- the power of computer floating point, you need to know its
+ the power of floating-point arithmetic, you need to know its
limitations and work within them. For most casual use of
floating-point arithmetic, you will often get the expected result
if you simply round the display of your final results to the
@@ -34865,171 +34860,171 @@ Node: Limitations872342
Node: Debugging Summary874457
Node: Arbitrary Precision Arithmetic875631
Node: Computer Arithmetic877047
-Ref: table-numeric-ranges880645
-Ref: Computer Arithmetic-Footnote-1881504
-Node: Math Definitions881561
-Ref: table-ieee-formats884849
-Ref: Math Definitions-Footnote-1885453
-Node: MPFR features885558
-Node: FP Math Caution887229
-Ref: FP Math Caution-Footnote-1888279
-Node: Inexactness of computations888648
-Node: Inexact representation889607
-Node: Comparing FP Values890964
-Node: Errors accumulate892046
-Node: Getting Accuracy893479
-Node: Try To Round896141
-Node: Setting precision897040
-Ref: table-predefined-precision-strings897724
-Node: Setting the rounding mode899513
-Ref: table-gawk-rounding-modes899877
-Ref: Setting the rounding mode-Footnote-1903332
-Node: Arbitrary Precision Integers903511
-Ref: Arbitrary Precision Integers-Footnote-1906497
-Node: POSIX Floating Point Problems906646
-Ref: POSIX Floating Point Problems-Footnote-1910519
-Node: Floating point summary910557
-Node: Dynamic Extensions912751
-Node: Extension Intro914303
-Node: Plugin License915569
-Node: Extension Mechanism Outline916366
-Ref: figure-load-extension916794
-Ref: figure-register-new-function918274
-Ref: figure-call-new-function919278
-Node: Extension API Description921264
-Node: Extension API Functions Introduction922714
-Node: General Data Types927538
-Ref: General Data Types-Footnote-1933277
-Node: Memory Allocation Functions933576
-Ref: Memory Allocation Functions-Footnote-1936415
-Node: Constructor Functions936511
-Node: Registration Functions938245
-Node: Extension Functions938930
-Node: Exit Callback Functions941227
-Node: Extension Version String942475
-Node: Input Parsers943140
-Node: Output Wrappers953019
-Node: Two-way processors957534
-Node: Printing Messages959738
-Ref: Printing Messages-Footnote-1960814
-Node: Updating `ERRNO'960966
-Node: Requesting Values961706
-Ref: table-value-types-returned962434
-Node: Accessing Parameters963391
-Node: Symbol Table Access964622
-Node: Symbol table by name965136
-Node: Symbol table by cookie967117
-Ref: Symbol table by cookie-Footnote-1971261
-Node: Cached values971324
-Ref: Cached values-Footnote-1974823
-Node: Array Manipulation974914
-Ref: Array Manipulation-Footnote-1976012
-Node: Array Data Types976049
-Ref: Array Data Types-Footnote-1978704
-Node: Array Functions978796
-Node: Flattening Arrays982650
-Node: Creating Arrays989542
-Node: Extension API Variables994313
-Node: Extension Versioning994949
-Node: Extension API Informational Variables996850
-Node: Extension API Boilerplate997915
-Node: Finding Extensions1001724
-Node: Extension Example1002284
-Node: Internal File Description1003056
-Node: Internal File Ops1007123
-Ref: Internal File Ops-Footnote-11018793
-Node: Using Internal File Ops1018933
-Ref: Using Internal File Ops-Footnote-11021316
-Node: Extension Samples1021589
-Node: Extension Sample File Functions1023115
-Node: Extension Sample Fnmatch1030753
-Node: Extension Sample Fork1032244
-Node: Extension Sample Inplace1033459
-Node: Extension Sample Ord1035134
-Node: Extension Sample Readdir1035970
-Ref: table-readdir-file-types1036846
-Node: Extension Sample Revout1037657
-Node: Extension Sample Rev2way1038247
-Node: Extension Sample Read write array1038987
-Node: Extension Sample Readfile1040927
-Node: Extension Sample Time1042022
-Node: Extension Sample API Tests1043371
-Node: gawkextlib1043862
-Node: Extension summary1046520
-Node: Extension Exercises1050209
-Node: Language History1050931
-Node: V7/SVR3.11052587
-Node: SVR41054768
-Node: POSIX1056213
-Node: BTL1057602
-Node: POSIX/GNU1058336
-Node: Feature History1063900
-Node: Common Extensions1076998
-Node: Ranges and Locales1078322
-Ref: Ranges and Locales-Footnote-11082940
-Ref: Ranges and Locales-Footnote-21082967
-Ref: Ranges and Locales-Footnote-31083201
-Node: Contributors1083422
-Node: History summary1088963
-Node: Installation1090333
-Node: Gawk Distribution1091279
-Node: Getting1091763
-Node: Extracting1092586
-Node: Distribution contents1094221
-Node: Unix Installation1099938
-Node: Quick Installation1100555
-Node: Additional Configuration Options1102979
-Node: Configuration Philosophy1104717
-Node: Non-Unix Installation1107086
-Node: PC Installation1107544
-Node: PC Binary Installation1108863
-Node: PC Compiling1110711
-Ref: PC Compiling-Footnote-11113732
-Node: PC Testing1113841
-Node: PC Using1115017
-Node: Cygwin1119132
-Node: MSYS1119955
-Node: VMS Installation1120455
-Node: VMS Compilation1121247
-Ref: VMS Compilation-Footnote-11122469
-Node: VMS Dynamic Extensions1122527
-Node: VMS Installation Details1124211
-Node: VMS Running1126463
-Node: VMS GNV1129299
-Node: VMS Old Gawk1130033
-Node: Bugs1130503
-Node: Other Versions1134386
-Node: Installation summary1140810
-Node: Notes1141866
-Node: Compatibility Mode1142731
-Node: Additions1143513
-Node: Accessing The Source1144438
-Node: Adding Code1145873
-Node: New Ports1152030
-Node: Derived Files1156512
-Ref: Derived Files-Footnote-11161987
-Ref: Derived Files-Footnote-21162021
-Ref: Derived Files-Footnote-31162617
-Node: Future Extensions1162731
-Node: Implementation Limitations1163337
-Node: Extension Design1164585
-Node: Old Extension Problems1165739
-Ref: Old Extension Problems-Footnote-11167256
-Node: Extension New Mechanism Goals1167313
-Ref: Extension New Mechanism Goals-Footnote-11170673
-Node: Extension Other Design Decisions1170862
-Node: Extension Future Growth1172970
-Node: Old Extension Mechanism1173806
-Node: Notes summary1175568
-Node: Basic Concepts1176754
-Node: Basic High Level1177435
-Ref: figure-general-flow1177707
-Ref: figure-process-flow1178306
-Ref: Basic High Level-Footnote-11181535
-Node: Basic Data Typing1181720
-Node: Glossary1185048
-Node: Copying1216977
-Node: GNU Free Documentation License1254533
-Node: Index1279669
+Ref: table-numeric-ranges880646
+Ref: Computer Arithmetic-Footnote-1881170
+Node: Math Definitions881227
+Ref: table-ieee-formats884522
+Ref: Math Definitions-Footnote-1885126
+Node: MPFR features885231
+Node: FP Math Caution886902
+Ref: FP Math Caution-Footnote-1887952
+Node: Inexactness of computations888321
+Node: Inexact representation889280
+Node: Comparing FP Values890638
+Node: Errors accumulate891720
+Node: Getting Accuracy893152
+Node: Try To Round895856
+Node: Setting precision896755
+Ref: table-predefined-precision-strings897439
+Node: Setting the rounding mode899268
+Ref: table-gawk-rounding-modes899632
+Ref: Setting the rounding mode-Footnote-1903084
+Node: Arbitrary Precision Integers903263
+Ref: Arbitrary Precision Integers-Footnote-1906247
+Node: POSIX Floating Point Problems906396
+Ref: POSIX Floating Point Problems-Footnote-1910275
+Node: Floating point summary910313
+Node: Dynamic Extensions912509
+Node: Extension Intro914061
+Node: Plugin License915327
+Node: Extension Mechanism Outline916124
+Ref: figure-load-extension916552
+Ref: figure-register-new-function918032
+Ref: figure-call-new-function919036
+Node: Extension API Description921022
+Node: Extension API Functions Introduction922472
+Node: General Data Types927296
+Ref: General Data Types-Footnote-1933035
+Node: Memory Allocation Functions933334
+Ref: Memory Allocation Functions-Footnote-1936173
+Node: Constructor Functions936269
+Node: Registration Functions938003
+Node: Extension Functions938688
+Node: Exit Callback Functions940985
+Node: Extension Version String942233
+Node: Input Parsers942898
+Node: Output Wrappers952777
+Node: Two-way processors957292
+Node: Printing Messages959496
+Ref: Printing Messages-Footnote-1960572
+Node: Updating `ERRNO'960724
+Node: Requesting Values961464
+Ref: table-value-types-returned962192
+Node: Accessing Parameters963149
+Node: Symbol Table Access964380
+Node: Symbol table by name964894
+Node: Symbol table by cookie966875
+Ref: Symbol table by cookie-Footnote-1971019
+Node: Cached values971082
+Ref: Cached values-Footnote-1974581
+Node: Array Manipulation974672
+Ref: Array Manipulation-Footnote-1975770
+Node: Array Data Types975807
+Ref: Array Data Types-Footnote-1978462
+Node: Array Functions978554
+Node: Flattening Arrays982408
+Node: Creating Arrays989300
+Node: Extension API Variables994071
+Node: Extension Versioning994707
+Node: Extension API Informational Variables996608
+Node: Extension API Boilerplate997673
+Node: Finding Extensions1001482
+Node: Extension Example1002042
+Node: Internal File Description1002814
+Node: Internal File Ops1006881
+Ref: Internal File Ops-Footnote-11018551
+Node: Using Internal File Ops1018691
+Ref: Using Internal File Ops-Footnote-11021074
+Node: Extension Samples1021347
+Node: Extension Sample File Functions1022873
+Node: Extension Sample Fnmatch1030511
+Node: Extension Sample Fork1032002
+Node: Extension Sample Inplace1033217
+Node: Extension Sample Ord1034892
+Node: Extension Sample Readdir1035728
+Ref: table-readdir-file-types1036604
+Node: Extension Sample Revout1037415
+Node: Extension Sample Rev2way1038005
+Node: Extension Sample Read write array1038745
+Node: Extension Sample Readfile1040685
+Node: Extension Sample Time1041780
+Node: Extension Sample API Tests1043129
+Node: gawkextlib1043620
+Node: Extension summary1046278
+Node: Extension Exercises1049967
+Node: Language History1050689
+Node: V7/SVR3.11052345
+Node: SVR41054526
+Node: POSIX1055971
+Node: BTL1057360
+Node: POSIX/GNU1058094
+Node: Feature History1063658
+Node: Common Extensions1076756
+Node: Ranges and Locales1078080
+Ref: Ranges and Locales-Footnote-11082698
+Ref: Ranges and Locales-Footnote-21082725
+Ref: Ranges and Locales-Footnote-31082959
+Node: Contributors1083180
+Node: History summary1088721
+Node: Installation1090091
+Node: Gawk Distribution1091037
+Node: Getting1091521
+Node: Extracting1092344
+Node: Distribution contents1093979
+Node: Unix Installation1099696
+Node: Quick Installation1100313
+Node: Additional Configuration Options1102737
+Node: Configuration Philosophy1104475
+Node: Non-Unix Installation1106844
+Node: PC Installation1107302
+Node: PC Binary Installation1108621
+Node: PC Compiling1110469
+Ref: PC Compiling-Footnote-11113490
+Node: PC Testing1113599
+Node: PC Using1114775
+Node: Cygwin1118890
+Node: MSYS1119713
+Node: VMS Installation1120213
+Node: VMS Compilation1121005
+Ref: VMS Compilation-Footnote-11122227
+Node: VMS Dynamic Extensions1122285
+Node: VMS Installation Details1123969
+Node: VMS Running1126221
+Node: VMS GNV1129057
+Node: VMS Old Gawk1129791
+Node: Bugs1130261
+Node: Other Versions1134144
+Node: Installation summary1140568
+Node: Notes1141624
+Node: Compatibility Mode1142489
+Node: Additions1143271
+Node: Accessing The Source1144196
+Node: Adding Code1145631
+Node: New Ports1151788
+Node: Derived Files1156270
+Ref: Derived Files-Footnote-11161745
+Ref: Derived Files-Footnote-21161779
+Ref: Derived Files-Footnote-31162375
+Node: Future Extensions1162489
+Node: Implementation Limitations1163095
+Node: Extension Design1164343
+Node: Old Extension Problems1165497
+Ref: Old Extension Problems-Footnote-11167014
+Node: Extension New Mechanism Goals1167071
+Ref: Extension New Mechanism Goals-Footnote-11170431
+Node: Extension Other Design Decisions1170620
+Node: Extension Future Growth1172728
+Node: Old Extension Mechanism1173564
+Node: Notes summary1175326
+Node: Basic Concepts1176512
+Node: Basic High Level1177193
+Ref: figure-general-flow1177465
+Ref: figure-process-flow1178064
+Ref: Basic High Level-Footnote-11181293
+Node: Basic Data Typing1181478
+Node: Glossary1184806
+Node: Copying1216735
+Node: GNU Free Documentation License1254291
+Node: Index1279427
End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index ed7f461..8cb24ea 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -30134,7 +30134,7 @@ paper and pencil (and/or a calculator). In theory,
numbers can have an
arbitrary number of digits on either side (or both sides) of the decimal
point, and the results of a computation are always exact.
-Some modern system can do decimal arithmetic in hardware, but usually you
+Some modern systems can do decimal arithmetic in hardware, but usually you
need a special software library to provide access to these instructions.
There are also libraries that do decimal arithmetic entirely in software.
@@ -30190,8 +30190,34 @@ signed. The possible ranges of values are shown in
@ref{table-numeric-ranges}.
@item 32-bit unsigned integer @tab 0 @tab 4,294,967,295
@item 64-bit signed integer @tab @minus{}9,223,372,036,854,775,808 @tab
9,223,372,036,854,775,807
@item 64-bit unsigned integer @tab 0 @tab 18,446,744,073,709,551,615
address@hidden Single-precision floating point (approximate) @tab
@code{1.175494e-38} @tab @code{3.402823e+38}
address@hidden Double-precision floating point (approximate) @tab
@code{2.225074e-308} @tab @code{1.797693e+308}
address@hidden
address@hidden Single-precision floating point (approximate) @tab
@math{1.175494^{-38}} @tab @math{3.402823^{38}}
address@hidden Double-precision floating point (approximate) @tab
@math{2.225074^{-308}} @tab @math{1.797693^{308}}
address@hidden iftex
address@hidden
address@hidden
address@hidden Single-precision floating point (approximate) @tab 1.175494e-38
@tab 3.402823e38
address@hidden Double-precision floating point (approximate) @tab 2.225074e-308
@tab 1.797693e308
address@hidden ifnotdocbook
address@hidden ifnottex
address@hidden
address@hidden Single-precision floating point (approximate) @tab
address@hidden
+1.175494<superscript>-38</superscript>
address@hidden docbook
address@hidden
address@hidden
+3.402823<superscript>38</superscript>
address@hidden docbook
address@hidden Double-precision floating point (approximate) @tab
address@hidden
+2.225074<superscript>-308</superscript>
address@hidden docbook
address@hidden
address@hidden
+1.797693<superscript>308</superscript>
address@hidden docbook
address@hidden ifdocbook
@end multitable
@end float
@@ -30200,7 +30226,7 @@ signed. The possible ranges of values are shown in
@ref{table-numeric-ranges}.
The rest of this @value{CHAPTER} uses a number of terms. Here are some
informal definitions that should help you work your way through the material
-here.
+here:
@table @dfn
@item Accuracy
@@ -30221,7 +30247,7 @@ A special value representing infinity. Operations
involving another
number and infinity produce infinity.
@item NaN
-``Not A Number.''@footnote{Thanks to Michael Brennan for this description,
+``Not a number.''@footnote{Thanks to Michael Brennan for this description,
which we have paraphrased, and for the examples.} A special value that
results from attempting a calculation that has no answer as a real number.
In such a case, programs can either receive a floating-point exception,
@@ -30264,8 +30290,8 @@ formula:
@end display
@noindent
-Here, @var{prec} denotes the binary precision
-(measured in bits) and @var{dps} (short for decimal places)
+Here, @emph{prec} denotes the binary precision
+(measured in bits) and @emph{dps} (short for decimal places)
is the decimal digits.
@item Rounding mode
@@ -30273,7 +30299,7 @@ How numbers are rounded up or down when necessary.
More details are provided later.
@item Significand
-A floating-point value consists the significand multiplied by 10
+A floating-point value consists of the significand multiplied by 10
to the power of the exponent. For example, in @code{1.2345e67},
the significand is @code{1.2345}.
@@ -30297,7 +30323,7 @@ to allow greater precisions and larger exponent ranges.
(@command{awk} uses only the 64-bit double-precision format.)
@ref{table-ieee-formats} lists the precision and exponent
-field values for the basic IEEE 754 binary formats:
+field values for the basic IEEE 754 binary formats.
@float Table,table-ieee-formats
@caption{Basic IEEE format values}
@@ -30361,12 +30387,12 @@ for more information.
@author Teen Talk Barbie, July 1992
@end quotation
-This @value{SECTION} provides a high level overview of the issues
+This @value{SECTION} provides a high-level overview of the issues
involved when doing lots of floating-point address@hidden
is a very nice @uref{http://www.validlab.com/goldberg/paper.pdf,
paper on floating-point arithmetic} by David Goldberg, ``What Every
-Computer Scientist Should Know About Floating-point Arithmetic,''
address@hidden Computing Surveys} @strong{23}, 1 (1991-03), 5-48. This is
+Computer Scientist Should Know About Floating-Point Arithmetic,''
address@hidden Computing Surveys} @strong{23}, 1 (1991-03): 5-48. This is
worth reading if you are interested in the details, but it does require
a background in computer science.}
The discussion applies to both hardware and arbitrary-precision
@@ -30435,7 +30461,7 @@ $ @kbd{gawk 'BEGIN @{ x = 0.875; y = 0.425}
Often the error is so small you do not even notice it, and if you do,
you can always specify how much precision you would like in your output.
-Usually this is a format string like @code{"%.15g"}, which when
+Usually this is a format string like @code{"%.15g"}, which, when
used in the previous example, produces an output identical to the input.
@node Comparing FP Values
@@ -30474,7 +30500,7 @@ else
The loss of accuracy during a single computation with floating-point
numbers usually isn't enough to worry about. However, if you compute a
-value which is the result of a sequence of floating-point operations,
+value that is the result of a sequence of floating-point operations,
the error can accumulate and greatly affect the computation itself.
Here is an attempt to compute the value of @value{PI} using one of its
many series representations:
@@ -30527,7 +30553,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 @samp{0.1 + 12.2} and
@@ -30567,7 +30593,8 @@ by our earlier attempt to compute the value of
@value{PI}.
Extra precision can greatly enhance the stability and the accuracy
of your computation in such cases.
-Repeated addition is not necessarily equivalent to multiplication
+Additionally, you should understand that
+repeated addition is not necessarily equivalent to multiplication
in floating-point arithmetic. In the example in
@ref{Errors accumulate}:
@@ -30630,7 +30657,7 @@ to emulate an IEEE 754 binary format.
@float Table,table-predefined-precision-strings
@caption{Predefined precision strings for @code{PREC}}
@multitable address@hidden"double"}} {12345678901234567890123456789012345}
address@hidden @code{PREC} @tab IEEE 754 Binary Format
address@hidden @code{PREC} @tab IEEE 754 binary format
@item @code{"half"} @tab 16-bit half-precision
@item @code{"single"} @tab Basic 32-bit single precision
@item @code{"double"} @tab Basic 64-bit double precision
@@ -30662,7 +30689,6 @@ than the default and cannot use a command-line
assignment to @code{PREC},
you should either specify the constant as a string, or as a rational
number, whenever possible. The following example illustrates the
differences among various ways to print a floating-point constant:
address@hidden quotation
@example
$ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 0.1) @}'}
@@ -30674,22 +30700,23 @@ $ @kbd{gawk -M 'BEGIN @{ PREC = 113;
printf("%0.25f\n", "0.1") @}'}
$ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 1/10) @}'}
@print{} 0.1000000000000000000000000
@end example
address@hidden quotation
@node Setting the rounding mode
@subsection Setting the Rounding Mode
The @code{ROUNDMODE} variable provides
-program level control over the rounding mode.
+program-level control over the rounding mode.
The correspondence between @code{ROUNDMODE} and the IEEE
rounding modes is shown in @ref{table-gawk-rounding-modes}.
@float Table,table-gawk-rounding-modes
@address@hidden rounding modes}
@multitable @columnfractions .45 .30 .25
address@hidden Rounding Mode @tab IEEE Name @tab @code{ROUNDMODE}
address@hidden Rounding mode @tab IEEE name @tab @code{ROUNDMODE}
@item Round to nearest, ties to even @tab @code{roundTiesToEven} @tab
@code{"N"} or @code{"n"}
address@hidden Round toward plus Infinity @tab @code{roundTowardPositive} @tab
@code{"U"} or @code{"u"}
address@hidden Round toward negative Infinity @tab @code{roundTowardNegative}
@tab @code{"D"} or @code{"d"}
address@hidden Round toward positive infinity @tab @code{roundTowardPositive}
@tab @code{"U"} or @code{"u"}
address@hidden Round toward negative infinity @tab @code{roundTowardNegative}
@tab @code{"D"} or @code{"d"}
@item Round toward zero @tab @code{roundTowardZero} @tab @code{"Z"} or
@code{"z"}
@item Round to nearest, ties away from zero @tab @code{roundTiesToAway} @tab
@code{"A"} or @code{"a"}
@end multitable
@@ -30750,8 +30777,8 @@ distributes upward and downward rounds of exact halves,
which might
cause any accumulating round-off error to cancel itself out. This is the
default rounding mode for IEEE 754 computing functions and operators.
-The other rounding modes are rarely used. Round toward positive infinity
-(@code{roundTowardPositive}) and round toward negative infinity
+The other rounding modes are rarely used. Rounding toward positive infinity
+(@code{roundTowardPositive}) and toward negative infinity
(@code{roundTowardNegative}) are often used to implement interval
arithmetic, where you adjust the rounding mode to calculate upper and
lower bounds for the range of output. The @code{roundTowardZero} mode can
@@ -30808,17 +30835,17 @@ If instead you were to compute the same value using
arbitrary-precision
floating-point values, the precision needed for correct output (using
the formula
@iftex
address@hidden = 3.322 @cdot dps}),
address@hidden = 3.322 @cdot dps})
would be @math{3.322 @cdot 183231},
@end iftex
@ifnottex
@ifnotdocbook
address@hidden = 3.322 * dps}),
address@hidden = 3.322 * dps})
would be 3.322 x 183231,
@end ifnotdocbook
@end ifnottex
@docbook
-<emphasis>prec</emphasis> = 3.322 ⋅ <emphasis>dps</emphasis>),
+<emphasis>prec</emphasis> = 3.322 ⋅ <emphasis>dps</emphasis>)
would be
<emphasis>prec</emphasis> = 3.322 ⋅ 183231, @c
@end docbook
@@ -30856,7 +30883,7 @@ interface to process arbitrary-precision integers or
mixed-mode numbers
as needed by an operation or function. In such a case, the precision is
set to the minimum value necessary for exact conversion, and the working
precision is not used for this purpose. If this is not what you need or
-want, you can employ a subterfuge, and convert the integer to floating
+want, you can employ a subterfuge and convert the integer to floating
point first, like this:
@example
@@ -30880,7 +30907,7 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}'
@node POSIX Floating Point Problems
@section Standards Versus Existing Practice
-Historically, @command{awk} has converted any non-numeric looking string
+Historically, @command{awk} has converted any nonnumeric-looking string
to the numeric value zero, when required. Furthermore, the original
definition of the language and the original POSIX standards specified that
@command{awk} only understands decimal numbers (base 10), and not octal
@@ -30897,8 +30924,8 @@ notation (e.g., @code{0xDEADBEEF}). (Note: data values,
@emph{not}
source code constants.)
@item
-Support for the special IEEE 754 floating-point values ``Not A Number''
-(NaN), positive Infinity (``inf''), and negative Infinity (address@hidden'').
+Support for the special IEEE 754 floating-point values ``not a number''
+(NaN), positive infinity (``inf''), and negative infinity (address@hidden'').
In particular, the format for these values is as specified by the ISO 1999
C standard, which ignores case and can allow implementation-dependent
additional
characters after the @samp{nan} and allow either @samp{inf} or @samp{infinity}.
@@ -30919,21 +30946,21 @@ values is also a very severe departure from
historical practice.
@end itemize
The second problem is that the @command{gawk} maintainer feels that this
-interpretation of the standard, which requires a certain amount of
+interpretation of the standard, which required a certain amount of
``language lawyering'' to arrive at in the first place, was not even
-intended by the standard developers. In other words, ``we see how you
+intended by the standard developers. In other words, ``We see how you
got where you are, but we don't think that that's where you want to be.''
Recognizing these issues, but attempting to provide compatibility
with the earlier versions of the standard,
the 2008 POSIX standard added explicit wording to allow, but not require,
that @command{awk} support hexadecimal floating-point values and
-special values for ``Not A Number'' and infinity.
+special values for ``not a number'' and infinity.
Although the @command{gawk} maintainer continues to feel that
providing those features is inadvisable,
nevertheless, on systems that support IEEE floating point, it seems
-reasonable to provide @emph{some} way to support NaN and Infinity values.
+reasonable to provide @emph{some} way to support NaN and infinity values.
The solution implemented in @command{gawk} is as follows:
@itemize @value{BULLET}
@@ -30953,7 +30980,7 @@ $ @kbd{echo 0xDeadBeef | gawk --posix '@{ print $1 + 0
@}'}
@end example
@item
-Without @option{--posix}, @command{gawk} interprets the four strings
+Without @option{--posix}, @command{gawk} interprets the four string values
@samp{+inf},
@samp{-inf},
@samp{+nan},
@@ -30975,7 +31002,7 @@ $ @kbd{echo 0xDeadBeef | gawk '@{ print $1 + 0 @}'}
@end example
@command{gawk} ignores case in the four special values.
-Thus @samp{+nan} and @samp{+NaN} are the same.
+Thus, @samp{+nan} and @samp{+NaN} are the same.
@end itemize
@node Floating point summary
@@ -30988,9 +31015,9 @@ values. Standard @command{awk} uses double-precision
floating-point values.
@item
-In the early 1990s, Barbie mistakenly said ``Math class is tough!''
+In the early 1990s Barbie mistakenly said, ``Math class is tough!''
Although math isn't tough, floating-point arithmetic isn't the same
-as pencil and paper math, and care must be taken:
+as pencil-and-paper math, and care must be taken:
@c nested list
@itemize @value{MINUS}
@@ -31023,7 +31050,7 @@ arithmetic. Use @code{PREC} to set the precision in
bits, and
@item
With @option{-M}, @command{gawk} performs
arbitrary-precision integer arithmetic using the GMP library.
-This is faster and more space efficient than using MPFR for
+This is faster and more space-efficient than using MPFR for
the same calculations.
@item
@@ -31035,7 +31062,7 @@ It pays to be aware of them.
Overall, there is no need to be unduly suspicious about the results from
floating-point arithmetic. The lesson to remember is that floating-point
arithmetic is always more complex than arithmetic using pencil and
-paper. In order to take advantage of the power of computer floating point,
+paper. In order to take advantage of the power of floating-point arithmetic,
you need to know its limitations and work within them. For most casual
use of floating-point arithmetic, you will often get the expected result
if you simply round the display of your final results to the correct number
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index 1156ffd..7c22902 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -29225,7 +29225,7 @@ paper and pencil (and/or a calculator). In theory,
numbers can have an
arbitrary number of digits on either side (or both sides) of the decimal
point, and the results of a computation are always exact.
-Some modern system can do decimal arithmetic in hardware, but usually you
+Some modern systems can do decimal arithmetic in hardware, but usually you
need a special software library to provide access to these instructions.
There are also libraries that do decimal arithmetic entirely in software.
@@ -29281,8 +29281,34 @@ signed. The possible ranges of values are shown in
@ref{table-numeric-ranges}.
@item 32-bit unsigned integer @tab 0 @tab 4,294,967,295
@item 64-bit signed integer @tab @minus{}9,223,372,036,854,775,808 @tab
9,223,372,036,854,775,807
@item 64-bit unsigned integer @tab 0 @tab 18,446,744,073,709,551,615
address@hidden Single-precision floating point (approximate) @tab
@code{1.175494e-38} @tab @code{3.402823e+38}
address@hidden Double-precision floating point (approximate) @tab
@code{2.225074e-308} @tab @code{1.797693e+308}
address@hidden
address@hidden Single-precision floating point (approximate) @tab
@math{1.175494^{-38}} @tab @math{3.402823^{38}}
address@hidden Double-precision floating point (approximate) @tab
@math{2.225074^{-308}} @tab @math{1.797693^{308}}
address@hidden iftex
address@hidden
address@hidden
address@hidden Single-precision floating point (approximate) @tab 1.175494e-38
@tab 3.402823e38
address@hidden Double-precision floating point (approximate) @tab 2.225074e-308
@tab 1.797693e308
address@hidden ifnotdocbook
address@hidden ifnottex
address@hidden
address@hidden Single-precision floating point (approximate) @tab
address@hidden
+1.175494<superscript>-38</superscript>
address@hidden docbook
address@hidden
address@hidden
+3.402823<superscript>38</superscript>
address@hidden docbook
address@hidden Double-precision floating point (approximate) @tab
address@hidden
+2.225074<superscript>-308</superscript>
address@hidden docbook
address@hidden
address@hidden
+1.797693<superscript>308</superscript>
address@hidden docbook
address@hidden ifdocbook
@end multitable
@end float
@@ -29291,7 +29317,7 @@ signed. The possible ranges of values are shown in
@ref{table-numeric-ranges}.
The rest of this @value{CHAPTER} uses a number of terms. Here are some
informal definitions that should help you work your way through the material
-here.
+here:
@table @dfn
@item Accuracy
@@ -29312,7 +29338,7 @@ A special value representing infinity. Operations
involving another
number and infinity produce infinity.
@item NaN
-``Not A Number.''@footnote{Thanks to Michael Brennan for this description,
+``Not a number.''@footnote{Thanks to Michael Brennan for this description,
which we have paraphrased, and for the examples.} A special value that
results from attempting a calculation that has no answer as a real number.
In such a case, programs can either receive a floating-point exception,
@@ -29355,8 +29381,8 @@ formula:
@end display
@noindent
-Here, @var{prec} denotes the binary precision
-(measured in bits) and @var{dps} (short for decimal places)
+Here, @emph{prec} denotes the binary precision
+(measured in bits) and @emph{dps} (short for decimal places)
is the decimal digits.
@item Rounding mode
@@ -29364,7 +29390,7 @@ How numbers are rounded up or down when necessary.
More details are provided later.
@item Significand
-A floating-point value consists the significand multiplied by 10
+A floating-point value consists of the significand multiplied by 10
to the power of the exponent. For example, in @code{1.2345e67},
the significand is @code{1.2345}.
@@ -29388,7 +29414,7 @@ to allow greater precisions and larger exponent ranges.
(@command{awk} uses only the 64-bit double-precision format.)
@ref{table-ieee-formats} lists the precision and exponent
-field values for the basic IEEE 754 binary formats:
+field values for the basic IEEE 754 binary formats.
@float Table,table-ieee-formats
@caption{Basic IEEE format values}
@@ -29452,12 +29478,12 @@ for more information.
@author Teen Talk Barbie, July 1992
@end quotation
-This @value{SECTION} provides a high level overview of the issues
+This @value{SECTION} provides a high-level overview of the issues
involved when doing lots of floating-point address@hidden
is a very nice @uref{http://www.validlab.com/goldberg/paper.pdf,
paper on floating-point arithmetic} by David Goldberg, ``What Every
-Computer Scientist Should Know About Floating-point Arithmetic,''
address@hidden Computing Surveys} @strong{23}, 1 (1991-03), 5-48. This is
+Computer Scientist Should Know About Floating-Point Arithmetic,''
address@hidden Computing Surveys} @strong{23}, 1 (1991-03): 5-48. This is
worth reading if you are interested in the details, but it does require
a background in computer science.}
The discussion applies to both hardware and arbitrary-precision
@@ -29526,7 +29552,7 @@ $ @kbd{gawk 'BEGIN @{ x = 0.875; y = 0.425}
Often the error is so small you do not even notice it, and if you do,
you can always specify how much precision you would like in your output.
-Usually this is a format string like @code{"%.15g"}, which when
+Usually this is a format string like @code{"%.15g"}, which, when
used in the previous example, produces an output identical to the input.
@node Comparing FP Values
@@ -29565,7 +29591,7 @@ else
The loss of accuracy during a single computation with floating-point
numbers usually isn't enough to worry about. However, if you compute a
-value which is the result of a sequence of floating-point operations,
+value that is the result of a sequence of floating-point operations,
the error can accumulate and greatly affect the computation itself.
Here is an attempt to compute the value of @value{PI} using one of its
many series representations:
@@ -29618,7 +29644,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 @samp{0.1 + 12.2} and
@@ -29658,7 +29684,8 @@ by our earlier attempt to compute the value of
@value{PI}.
Extra precision can greatly enhance the stability and the accuracy
of your computation in such cases.
-Repeated addition is not necessarily equivalent to multiplication
+Additionally, you should understand that
+repeated addition is not necessarily equivalent to multiplication
in floating-point arithmetic. In the example in
@ref{Errors accumulate}:
@@ -29721,7 +29748,7 @@ to emulate an IEEE 754 binary format.
@float Table,table-predefined-precision-strings
@caption{Predefined precision strings for @code{PREC}}
@multitable address@hidden"double"}} {12345678901234567890123456789012345}
address@hidden @code{PREC} @tab IEEE 754 Binary Format
address@hidden @code{PREC} @tab IEEE 754 binary format
@item @code{"half"} @tab 16-bit half-precision
@item @code{"single"} @tab Basic 32-bit single precision
@item @code{"double"} @tab Basic 64-bit double precision
@@ -29753,7 +29780,6 @@ than the default and cannot use a command-line
assignment to @code{PREC},
you should either specify the constant as a string, or as a rational
number, whenever possible. The following example illustrates the
differences among various ways to print a floating-point constant:
address@hidden quotation
@example
$ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 0.1) @}'}
@@ -29765,22 +29791,23 @@ $ @kbd{gawk -M 'BEGIN @{ PREC = 113;
printf("%0.25f\n", "0.1") @}'}
$ @kbd{gawk -M 'BEGIN @{ PREC = 113; printf("%0.25f\n", 1/10) @}'}
@print{} 0.1000000000000000000000000
@end example
address@hidden quotation
@node Setting the rounding mode
@subsection Setting the Rounding Mode
The @code{ROUNDMODE} variable provides
-program level control over the rounding mode.
+program-level control over the rounding mode.
The correspondence between @code{ROUNDMODE} and the IEEE
rounding modes is shown in @ref{table-gawk-rounding-modes}.
@float Table,table-gawk-rounding-modes
@address@hidden rounding modes}
@multitable @columnfractions .45 .30 .25
address@hidden Rounding Mode @tab IEEE Name @tab @code{ROUNDMODE}
address@hidden Rounding mode @tab IEEE name @tab @code{ROUNDMODE}
@item Round to nearest, ties to even @tab @code{roundTiesToEven} @tab
@code{"N"} or @code{"n"}
address@hidden Round toward plus Infinity @tab @code{roundTowardPositive} @tab
@code{"U"} or @code{"u"}
address@hidden Round toward negative Infinity @tab @code{roundTowardNegative}
@tab @code{"D"} or @code{"d"}
address@hidden Round toward positive infinity @tab @code{roundTowardPositive}
@tab @code{"U"} or @code{"u"}
address@hidden Round toward negative infinity @tab @code{roundTowardNegative}
@tab @code{"D"} or @code{"d"}
@item Round toward zero @tab @code{roundTowardZero} @tab @code{"Z"} or
@code{"z"}
@item Round to nearest, ties away from zero @tab @code{roundTiesToAway} @tab
@code{"A"} or @code{"a"}
@end multitable
@@ -29841,8 +29868,8 @@ distributes upward and downward rounds of exact halves,
which might
cause any accumulating round-off error to cancel itself out. This is the
default rounding mode for IEEE 754 computing functions and operators.
-The other rounding modes are rarely used. Round toward positive infinity
-(@code{roundTowardPositive}) and round toward negative infinity
+The other rounding modes are rarely used. Rounding toward positive infinity
+(@code{roundTowardPositive}) and toward negative infinity
(@code{roundTowardNegative}) are often used to implement interval
arithmetic, where you adjust the rounding mode to calculate upper and
lower bounds for the range of output. The @code{roundTowardZero} mode can
@@ -29899,17 +29926,17 @@ If instead you were to compute the same value using
arbitrary-precision
floating-point values, the precision needed for correct output (using
the formula
@iftex
address@hidden = 3.322 @cdot dps}),
address@hidden = 3.322 @cdot dps})
would be @math{3.322 @cdot 183231},
@end iftex
@ifnottex
@ifnotdocbook
address@hidden = 3.322 * dps}),
address@hidden = 3.322 * dps})
would be 3.322 x 183231,
@end ifnotdocbook
@end ifnottex
@docbook
-<emphasis>prec</emphasis> = 3.322 ⋅ <emphasis>dps</emphasis>),
+<emphasis>prec</emphasis> = 3.322 ⋅ <emphasis>dps</emphasis>)
would be
<emphasis>prec</emphasis> = 3.322 ⋅ 183231, @c
@end docbook
@@ -29947,7 +29974,7 @@ interface to process arbitrary-precision integers or
mixed-mode numbers
as needed by an operation or function. In such a case, the precision is
set to the minimum value necessary for exact conversion, and the working
precision is not used for this purpose. If this is not what you need or
-want, you can employ a subterfuge, and convert the integer to floating
+want, you can employ a subterfuge and convert the integer to floating
point first, like this:
@example
@@ -29971,7 +29998,7 @@ gawk -M 'BEGIN @{ n = 13; print n % 2 @}'
@node POSIX Floating Point Problems
@section Standards Versus Existing Practice
-Historically, @command{awk} has converted any non-numeric looking string
+Historically, @command{awk} has converted any nonnumeric-looking string
to the numeric value zero, when required. Furthermore, the original
definition of the language and the original POSIX standards specified that
@command{awk} only understands decimal numbers (base 10), and not octal
@@ -29988,8 +30015,8 @@ notation (e.g., @code{0xDEADBEEF}). (Note: data values,
@emph{not}
source code constants.)
@item
-Support for the special IEEE 754 floating-point values ``Not A Number''
-(NaN), positive Infinity (``inf''), and negative Infinity (address@hidden'').
+Support for the special IEEE 754 floating-point values ``not a number''
+(NaN), positive infinity (``inf''), and negative infinity (address@hidden'').
In particular, the format for these values is as specified by the ISO 1999
C standard, which ignores case and can allow implementation-dependent
additional
characters after the @samp{nan} and allow either @samp{inf} or @samp{infinity}.
@@ -30010,21 +30037,21 @@ values is also a very severe departure from
historical practice.
@end itemize
The second problem is that the @command{gawk} maintainer feels that this
-interpretation of the standard, which requires a certain amount of
+interpretation of the standard, which required a certain amount of
``language lawyering'' to arrive at in the first place, was not even
-intended by the standard developers. In other words, ``we see how you
+intended by the standard developers. In other words, ``We see how you
got where you are, but we don't think that that's where you want to be.''
Recognizing these issues, but attempting to provide compatibility
with the earlier versions of the standard,
the 2008 POSIX standard added explicit wording to allow, but not require,
that @command{awk} support hexadecimal floating-point values and
-special values for ``Not A Number'' and infinity.
+special values for ``not a number'' and infinity.
Although the @command{gawk} maintainer continues to feel that
providing those features is inadvisable,
nevertheless, on systems that support IEEE floating point, it seems
-reasonable to provide @emph{some} way to support NaN and Infinity values.
+reasonable to provide @emph{some} way to support NaN and infinity values.
The solution implemented in @command{gawk} is as follows:
@itemize @value{BULLET}
@@ -30044,7 +30071,7 @@ $ @kbd{echo 0xDeadBeef | gawk --posix '@{ print $1 + 0
@}'}
@end example
@item
-Without @option{--posix}, @command{gawk} interprets the four strings
+Without @option{--posix}, @command{gawk} interprets the four string values
@samp{+inf},
@samp{-inf},
@samp{+nan},
@@ -30066,7 +30093,7 @@ $ @kbd{echo 0xDeadBeef | gawk '@{ print $1 + 0 @}'}
@end example
@command{gawk} ignores case in the four special values.
-Thus @samp{+nan} and @samp{+NaN} are the same.
+Thus, @samp{+nan} and @samp{+NaN} are the same.
@end itemize
@node Floating point summary
@@ -30079,9 +30106,9 @@ values. Standard @command{awk} uses double-precision
floating-point values.
@item
-In the early 1990s, Barbie mistakenly said ``Math class is tough!''
+In the early 1990s Barbie mistakenly said, ``Math class is tough!''
Although math isn't tough, floating-point arithmetic isn't the same
-as pencil and paper math, and care must be taken:
+as pencil-and-paper math, and care must be taken:
@c nested list
@itemize @value{MINUS}
@@ -30114,7 +30141,7 @@ arithmetic. Use @code{PREC} to set the precision in
bits, and
@item
With @option{-M}, @command{gawk} performs
arbitrary-precision integer arithmetic using the GMP library.
-This is faster and more space efficient than using MPFR for
+This is faster and more space-efficient than using MPFR for
the same calculations.
@item
@@ -30126,7 +30153,7 @@ It pays to be aware of them.
Overall, there is no need to be unduly suspicious about the results from
floating-point arithmetic. The lesson to remember is that floating-point
arithmetic is always more complex than arithmetic using pencil and
-paper. In order to take advantage of the power of computer floating point,
+paper. In order to take advantage of the power of floating-point arithmetic,
you need to know its limitations and work within them. For most casual
use of floating-point arithmetic, you will often get the expected result
if you simply round the display of your final results to the correct number
-----------------------------------------------------------------------
Summary of changes:
doc/gawk.info | 429 +++++++++++++++++++++++++++----------------------------
doc/gawk.texi | 109 +++++++++------
doc/gawktexi.in | 109 +++++++++------
3 files changed, 348 insertions(+), 299 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-582-g1f6b16d,
Arnold Robbins <=