diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/ChangeLog | 5 | ||||
-rw-r--r-- | doc/gawk.info | 369 | ||||
-rw-r--r-- | doc/gawk.texi | 15 |
3 files changed, 211 insertions, 178 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog index c0bf0391..5372f7da 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2012-08-24 Arnold D. Robbins <arnold@skeeve.com> + + * gawk.texi: Emphasize more that floating point behavior is + not a language issue. Add a pointer to POSIX bc. + 2012-08-17 Arnold D. Robbins <arnold@skeeve.com> * texinfo.tex: Update infrastructure to Automake 1.12.3. diff --git a/doc/gawk.info b/doc/gawk.info index 4cc3f9f8..18e455cc 100644 --- a/doc/gawk.info +++ b/doc/gawk.info @@ -13939,6 +13939,12 @@ This shows that some values can be represented exactly, whereas others are only approximated. This is not a "bug" in `awk', but simply an artifact of how computers represent numbers. + NOTE: It cannot be emphasized enough that the behavior just + described is fundamental to modern computers. You will see this + kind of thing happen in _any_ programming language using hardware + floating-point numbers. It is _not_ a bug in `gawk', nor is it + something that can be "just fixed." + Another peculiarity of floating-point numbers on modern systems is that they often have more than one representation for the number zero! In particular, it is possible to represent "minus zero" as well as @@ -14108,7 +14114,7 @@ hardware floating-point (as used by standard `awk' and the default for `gawk'), and "arbitrary-precision" floating-point, which is software based. This major node aims to provide enough information to understand both, and then will focus on `gawk''s facilities for the -latter. +latter.(1) Binary floating-point representations and arithmetic are inexact. Simple values like 0.1 cannot be precisely represented using binary @@ -14235,6 +14241,14 @@ implies better precision than is actually the case. * Floating-point Context:: Floating-point context. * Rounding Mode:: Floating-point rounding mode. + ---------- Footnotes ---------- + + (1) If you are interested in other tools that perform arbitrary +precision arithmetic, you may want to investigate the POSIX `bc' tool. +See the POSIX specification for it +(http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html), for +more information. + File: gawk.info, Node: Floating-point Representation, Next: Floating-point Context, Up: Floating-point Programming @@ -27468,7 +27482,7 @@ Index * namespace issues: Arrays. (line 18) * namespace issues, functions: Definition Syntax. (line 20) * nawk utility: Names. (line 17) -* negative zero: Unexpected Results. (line 28) +* negative zero: Unexpected Results. (line 34) * NetBSD: Glossary. (line 611) * networks, programming: TCP/IP Networking. (line 6) * networks, support for: Special Network. (line 6) @@ -27705,7 +27719,7 @@ Index * positional specifiers, printf statement: Format Modifiers. (line 13) * positional specifiers, printf statement, mixing with regular formats: Printf Ordering. (line 57) -* positive zero: Unexpected Results. (line 28) +* positive zero: Unexpected Results. (line 34) * POSIX awk <1>: Assignment Ops. (line 136) * POSIX awk: This Manual. (line 14) * POSIX awk, ** operator and: Precedence. (line 98) @@ -28373,7 +28387,7 @@ Index * Zaretskii, Eli <1>: Bugs. (line 70) * Zaretskii, Eli <2>: Contributors. (line 56) * Zaretskii, Eli: Acknowledgments. (line 60) -* zero, negative vs. positive: Unexpected Results. (line 28) +* zero, negative vs. positive: Unexpected Results. (line 34) * zerofile.awk program: Empty Files. (line 21) * Zoulas, Christos: Contributors. (line 67) * {} (braces): Profiling. (line 134) @@ -28674,178 +28688,179 @@ Node: Floating Point Issues572619 Node: String Conversion Precision573714 Ref: String Conversion Precision-Footnote-1575420 Node: Unexpected Results575529 -Node: POSIX Floating Point Problems577367 -Ref: POSIX Floating Point Problems-Footnote-1581192 -Node: Integer Programming581230 -Node: Floating-point Programming582978 -Node: Floating-point Representation589203 -Node: Floating-point Context590370 -Ref: table-ieee-formats591212 -Node: Rounding Mode592596 -Ref: table-rounding-modes593075 -Ref: Rounding Mode-Footnote-1596079 -Node: Gawk and MPFR596260 -Node: Arbitrary Precision Floats597501 -Ref: Arbitrary Precision Floats-Footnote-1599923 -Node: Setting Precision600234 -Node: Setting Rounding Mode602961 -Ref: table-gawk-rounding-modes603365 -Node: Floating-point Constants604562 -Node: Changing Precision605984 -Ref: Changing Precision-Footnote-1607384 -Node: Exact Arithmetic607558 -Node: Arbitrary Precision Integers610656 -Ref: Arbitrary Precision Integers-Footnote-1613738 -Node: Advanced Features613885 -Node: Nondecimal Data615408 -Node: Array Sorting616991 -Node: Controlling Array Traversal617688 -Node: Array Sorting Functions625925 -Ref: Array Sorting Functions-Footnote-1629599 -Ref: Array Sorting Functions-Footnote-2629692 -Node: Two-way I/O629886 -Ref: Two-way I/O-Footnote-1635318 -Node: TCP/IP Networking635388 -Node: Profiling638232 -Node: Library Functions645686 -Ref: Library Functions-Footnote-1648693 -Node: Library Names648864 -Ref: Library Names-Footnote-1652335 -Ref: Library Names-Footnote-2652555 -Node: General Functions652641 -Node: Strtonum Function653594 -Node: Assert Function656524 -Node: Round Function659850 -Node: Cliff Random Function661393 -Node: Ordinal Functions662409 -Ref: Ordinal Functions-Footnote-1665479 -Ref: Ordinal Functions-Footnote-2665731 -Node: Join Function665940 -Ref: Join Function-Footnote-1667711 -Node: Getlocaltime Function667911 -Node: Data File Management671626 -Node: Filetrans Function672258 -Node: Rewind Function676397 -Node: File Checking677784 -Node: Empty Files678878 -Node: Ignoring Assigns681108 -Node: Getopt Function682661 -Ref: Getopt Function-Footnote-1693965 -Node: Passwd Functions694168 -Ref: Passwd Functions-Footnote-1703143 -Node: Group Functions703231 -Node: Walking Arrays711315 -Node: Sample Programs712884 -Node: Running Examples713549 -Node: Clones714277 -Node: Cut Program715501 -Node: Egrep Program725346 -Ref: Egrep Program-Footnote-1733119 -Node: Id Program733229 -Node: Split Program736845 -Ref: Split Program-Footnote-1740364 -Node: Tee Program740492 -Node: Uniq Program743295 -Node: Wc Program750724 -Ref: Wc Program-Footnote-1754990 -Ref: Wc Program-Footnote-2755190 -Node: Miscellaneous Programs755282 -Node: Dupword Program756470 -Node: Alarm Program758501 -Node: Translate Program763250 -Ref: Translate Program-Footnote-1767637 -Ref: Translate Program-Footnote-2767865 -Node: Labels Program767999 -Ref: Labels Program-Footnote-1771370 -Node: Word Sorting771454 -Node: History Sorting775338 -Node: Extract Program777177 -Ref: Extract Program-Footnote-1784660 -Node: Simple Sed784788 -Node: Igawk Program787850 -Ref: Igawk Program-Footnote-1803007 -Ref: Igawk Program-Footnote-2803208 -Node: Anagram Program803346 -Node: Signature Program806414 -Node: Debugger807514 -Node: Debugging808468 -Node: Debugging Concepts808901 -Node: Debugging Terms810757 -Node: Awk Debugging813354 -Node: Sample Debugging Session814246 -Node: Debugger Invocation814766 -Node: Finding The Bug816095 -Node: List of Debugger Commands822583 -Node: Breakpoint Control823917 -Node: Debugger Execution Control827581 -Node: Viewing And Changing Data830941 -Node: Execution Stack834297 -Node: Debugger Info835764 -Node: Miscellaneous Debugger Commands839745 -Node: Readline Support845190 -Node: Limitations846021 -Node: Dynamic Extensions848273 -Node: Plugin License849169 -Node: Sample Library849783 -Node: Internal File Description850467 -Node: Internal File Ops854180 -Ref: Internal File Ops-Footnote-1858743 -Node: Using Internal File Ops858883 -Node: Language History861259 -Node: V7/SVR3.1862781 -Node: SVR4865102 -Node: POSIX866544 -Node: BTL867552 -Node: POSIX/GNU868286 -Node: Common Extensions873821 -Node: Ranges and Locales874928 -Ref: Ranges and Locales-Footnote-1879546 -Ref: Ranges and Locales-Footnote-2879573 -Ref: Ranges and Locales-Footnote-3879833 -Node: Contributors880054 -Node: Installation884350 -Node: Gawk Distribution885244 -Node: Getting885728 -Node: Extracting886554 -Node: Distribution contents888246 -Node: Unix Installation893468 -Node: Quick Installation894085 -Node: Additional Configuration Options896047 -Node: Configuration Philosophy897524 -Node: Non-Unix Installation899866 -Node: PC Installation900324 -Node: PC Binary Installation901623 -Node: PC Compiling903471 -Node: PC Testing906415 -Node: PC Using907591 -Node: Cygwin911776 -Node: MSYS912776 -Node: VMS Installation913290 -Node: VMS Compilation913893 -Ref: VMS Compilation-Footnote-1914900 -Node: VMS Installation Details914958 -Node: VMS Running916593 -Node: VMS Old Gawk918200 -Node: Bugs918674 -Node: Other Versions922526 -Node: Notes927841 -Node: Compatibility Mode928428 -Node: Additions929211 -Node: Accessing The Source930138 -Node: Adding Code931563 -Node: New Ports937571 -Node: Derived Files941706 -Ref: Derived Files-Footnote-1947010 -Ref: Derived Files-Footnote-2947044 -Ref: Derived Files-Footnote-3947644 -Node: Future Extensions947742 -Node: Basic Concepts949229 -Node: Basic High Level949910 -Ref: Basic High Level-Footnote-1953945 -Node: Basic Data Typing954130 -Node: Glossary957485 -Node: Copying982461 -Node: GNU Free Documentation License1020018 -Node: Index1045155 +Node: POSIX Floating Point Problems577682 +Ref: POSIX Floating Point Problems-Footnote-1581507 +Node: Integer Programming581545 +Node: Floating-point Programming583293 +Ref: Floating-point Programming-Footnote-1589557 +Node: Floating-point Representation589821 +Node: Floating-point Context590988 +Ref: table-ieee-formats591830 +Node: Rounding Mode593214 +Ref: table-rounding-modes593693 +Ref: Rounding Mode-Footnote-1596697 +Node: Gawk and MPFR596878 +Node: Arbitrary Precision Floats598119 +Ref: Arbitrary Precision Floats-Footnote-1600541 +Node: Setting Precision600852 +Node: Setting Rounding Mode603579 +Ref: table-gawk-rounding-modes603983 +Node: Floating-point Constants605180 +Node: Changing Precision606602 +Ref: Changing Precision-Footnote-1608002 +Node: Exact Arithmetic608176 +Node: Arbitrary Precision Integers611274 +Ref: Arbitrary Precision Integers-Footnote-1614356 +Node: Advanced Features614503 +Node: Nondecimal Data616026 +Node: Array Sorting617609 +Node: Controlling Array Traversal618306 +Node: Array Sorting Functions626543 +Ref: Array Sorting Functions-Footnote-1630217 +Ref: Array Sorting Functions-Footnote-2630310 +Node: Two-way I/O630504 +Ref: Two-way I/O-Footnote-1635936 +Node: TCP/IP Networking636006 +Node: Profiling638850 +Node: Library Functions646304 +Ref: Library Functions-Footnote-1649311 +Node: Library Names649482 +Ref: Library Names-Footnote-1652953 +Ref: Library Names-Footnote-2653173 +Node: General Functions653259 +Node: Strtonum Function654212 +Node: Assert Function657142 +Node: Round Function660468 +Node: Cliff Random Function662011 +Node: Ordinal Functions663027 +Ref: Ordinal Functions-Footnote-1666097 +Ref: Ordinal Functions-Footnote-2666349 +Node: Join Function666558 +Ref: Join Function-Footnote-1668329 +Node: Getlocaltime Function668529 +Node: Data File Management672244 +Node: Filetrans Function672876 +Node: Rewind Function677015 +Node: File Checking678402 +Node: Empty Files679496 +Node: Ignoring Assigns681726 +Node: Getopt Function683279 +Ref: Getopt Function-Footnote-1694583 +Node: Passwd Functions694786 +Ref: Passwd Functions-Footnote-1703761 +Node: Group Functions703849 +Node: Walking Arrays711933 +Node: Sample Programs713502 +Node: Running Examples714167 +Node: Clones714895 +Node: Cut Program716119 +Node: Egrep Program725964 +Ref: Egrep Program-Footnote-1733737 +Node: Id Program733847 +Node: Split Program737463 +Ref: Split Program-Footnote-1740982 +Node: Tee Program741110 +Node: Uniq Program743913 +Node: Wc Program751342 +Ref: Wc Program-Footnote-1755608 +Ref: Wc Program-Footnote-2755808 +Node: Miscellaneous Programs755900 +Node: Dupword Program757088 +Node: Alarm Program759119 +Node: Translate Program763868 +Ref: Translate Program-Footnote-1768255 +Ref: Translate Program-Footnote-2768483 +Node: Labels Program768617 +Ref: Labels Program-Footnote-1771988 +Node: Word Sorting772072 +Node: History Sorting775956 +Node: Extract Program777795 +Ref: Extract Program-Footnote-1785278 +Node: Simple Sed785406 +Node: Igawk Program788468 +Ref: Igawk Program-Footnote-1803625 +Ref: Igawk Program-Footnote-2803826 +Node: Anagram Program803964 +Node: Signature Program807032 +Node: Debugger808132 +Node: Debugging809086 +Node: Debugging Concepts809519 +Node: Debugging Terms811375 +Node: Awk Debugging813972 +Node: Sample Debugging Session814864 +Node: Debugger Invocation815384 +Node: Finding The Bug816713 +Node: List of Debugger Commands823201 +Node: Breakpoint Control824535 +Node: Debugger Execution Control828199 +Node: Viewing And Changing Data831559 +Node: Execution Stack834915 +Node: Debugger Info836382 +Node: Miscellaneous Debugger Commands840363 +Node: Readline Support845808 +Node: Limitations846639 +Node: Dynamic Extensions848891 +Node: Plugin License849787 +Node: Sample Library850401 +Node: Internal File Description851085 +Node: Internal File Ops854798 +Ref: Internal File Ops-Footnote-1859361 +Node: Using Internal File Ops859501 +Node: Language History861877 +Node: V7/SVR3.1863399 +Node: SVR4865720 +Node: POSIX867162 +Node: BTL868170 +Node: POSIX/GNU868904 +Node: Common Extensions874439 +Node: Ranges and Locales875546 +Ref: Ranges and Locales-Footnote-1880164 +Ref: Ranges and Locales-Footnote-2880191 +Ref: Ranges and Locales-Footnote-3880451 +Node: Contributors880672 +Node: Installation884968 +Node: Gawk Distribution885862 +Node: Getting886346 +Node: Extracting887172 +Node: Distribution contents888864 +Node: Unix Installation894086 +Node: Quick Installation894703 +Node: Additional Configuration Options896665 +Node: Configuration Philosophy898142 +Node: Non-Unix Installation900484 +Node: PC Installation900942 +Node: PC Binary Installation902241 +Node: PC Compiling904089 +Node: PC Testing907033 +Node: PC Using908209 +Node: Cygwin912394 +Node: MSYS913394 +Node: VMS Installation913908 +Node: VMS Compilation914511 +Ref: VMS Compilation-Footnote-1915518 +Node: VMS Installation Details915576 +Node: VMS Running917211 +Node: VMS Old Gawk918818 +Node: Bugs919292 +Node: Other Versions923144 +Node: Notes928459 +Node: Compatibility Mode929046 +Node: Additions929829 +Node: Accessing The Source930756 +Node: Adding Code932181 +Node: New Ports938189 +Node: Derived Files942324 +Ref: Derived Files-Footnote-1947628 +Ref: Derived Files-Footnote-2947662 +Ref: Derived Files-Footnote-3948262 +Node: Future Extensions948360 +Node: Basic Concepts949847 +Node: Basic High Level950528 +Ref: Basic High Level-Footnote-1954563 +Node: Basic Data Typing954748 +Node: Glossary958103 +Node: Copying983079 +Node: GNU Free Documentation License1020636 +Node: Index1045773 End Tag Table diff --git a/doc/gawk.texi b/doc/gawk.texi index 46a962dd..7d463a3d 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -18696,6 +18696,15 @@ whereas others are only approximated. This is not a ``bug'' in @command{awk}, but simply an artifact of how computers represent numbers. +@quotation NOTE +It cannot be emphasized enough that the behavior just +described is fundamental to modern computers. You will +see this kind of thing happen in @emph{any} programming +language using hardware floating-point numbers. It is @emph{not} +a bug in @command{gawk}, nor is it something that can be ``just +fixed.'' +@end quotation + @cindex negative zero @cindex positive zero @cindex zero@comma{} negative vs.@: positive @@ -18908,7 +18917,11 @@ hardware floating-point (as used by standard @command{awk} and the default for @command{gawk}), and @dfn{arbitrary-precision} floating-point, which is software based. This @value{CHAPTER} aims to provide enough information to understand both, and then -will focus on @command{gawk}'s facilities for the latter. +will focus on @command{gawk}'s facilities for the latter.@footnote{If you +are interested in other tools that perform arbitrary precision arithmetic, +you may want to investigate the POSIX @command{bc} tool. See +@uref{http://pubs.opengroup.org/onlinepubs/009695399/utilities/bc.html, +the POSIX specification for it}, for more information.} Binary floating-point representations and arithmetic are inexact. Simple values like 0.1 cannot be precisely represented using |