gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2546-g67f4d0


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, master, updated. gawk-4.1.0-2546-g67f4d07
Date: Sun, 16 Apr 2017 04:04:52 -0400 (EDT)

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, master has been updated
       via  67f4d070335e12622af1363b71c68489c64f5bc7 (commit)
      from  0813c48d190d983cb0b3e55f5d8345c91c43e09b (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=67f4d070335e12622af1363b71c68489c64f5bc7

commit 67f4d070335e12622af1363b71c68489c64f5bc7
Author: Arnold D. Robbins <address@hidden>
Date:   Sun Apr 16 11:04:29 2017 +0300

    Fixes for intdiv function, including documentation.

diff --git a/ChangeLog b/ChangeLog
index 8972233..77db900 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-04-16         Arnold D. Robbins     <address@hidden>
+
+       * builtin.c (do_intdiv): Use DEREF on the arguments.
+       Thanks to Andrew Schorr for finding the problem.
+       * mpfr.c (do_mpfr_intdiv): Return -1 if numerator or denominator
+       are not valid numbers.  Unref various bits first.
+
 2017-04-12         Arnold D. Robbins     <address@hidden>
 
        * mpfr.c (mpg_format_val): Set STRCUR flag when we're done.
diff --git a/builtin.c b/builtin.c
index b358763..87d9dcb 100644
--- a/builtin.c
+++ b/builtin.c
@@ -4034,6 +4034,9 @@ do_intdiv(int nargs)
        unref(*lhs);
        *lhs = make_number((AWKNUM) remainder);
 
+       DEREF(denominator);
+       DEREF(numerator);
+
        return make_number((AWKNUM) 0.0);
 }
 
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 4da39fe..39fc802 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2017-04-16         Arnold D. Robbins     <address@hidden>
+
+       * gawktexi.in: Improve documentation of the intdiv() function.
+
 2017-04-12         Arnold D. Robbins     <address@hidden>
 
        * it: New directory with Italian translation of the manual.
diff --git a/doc/gawk.info b/doc/gawk.info
index d3ae563..238df1d 100644
--- a/doc/gawk.info
+++ b/doc/gawk.info
@@ -12268,16 +12268,19 @@ brackets ([ ]):
      3, 'int(-3.9)' is -3, and 'int(-3)' is -3 as well.
 
 'intdiv(NUMERATOR, DENOMINATOR, RESULT)'
-     Perform integer division, similar to the standard C function of the
-     same name.  First, truncate 'numerator' and 'denominator' towards
+     Perform integer division, similar to the standard C 'div()'
+     function.  First, truncate 'numerator' and 'denominator' towards
      zero, creating integer values.  Clear the 'result' array, and then
      set 'result["quotient"]' to the result of 'numerator /
      denominator', truncated towards zero to an integer, and set
      'result["remainder"]' to the result of 'numerator % denominator',
-     truncated towards zero to an integer.  This function is primarily
-     intended for use with arbitrary length integers; it avoids creating
-     MPFR arbitrary precision floating-point values (*note Arbitrary
-     Precision Integers::).
+     truncated towards zero to an integer.  Attempting division by zero
+     causes a fatal error.  The function returns zero upon success, and
+     -1 upon error.
+
+     This function is primarily intended for use with arbitrary length
+     integers; it avoids creating MPFR arbitrary precision
+     floating-point values (*note Arbitrary Precision Integers::).
 
      This function is a 'gawk' extension.  It is not available in
      compatibility mode (*note Options::).
@@ -34422,9 +34425,9 @@ Index
 * localization:                          I18N and L10N.       (line   6)
 * localization, See internationalization, localization: I18N and L10N.
                                                               (line   6)
-* log:                                   Numeric Functions.   (line  44)
+* log:                                   Numeric Functions.   (line  47)
 * log files, timestamps in:              Time Functions.      (line   6)
-* logarithm:                             Numeric Functions.   (line  44)
+* logarithm:                             Numeric Functions.   (line  47)
 * logical false/true:                    Truth Values.        (line   6)
 * logical operators, See Boolean expressions: Boolean Ops.    (line   6)
 * login information:                     Passwd Functions.    (line  16)
@@ -34887,12 +34890,12 @@ Index
 * Rakitzis, Byron:                       History Sorting.     (line  25)
 * Ramey, Chet:                           Acknowledgments.     (line  60)
 * Ramey, Chet <1>:                       General Data Types.  (line   6)
-* rand:                                  Numeric Functions.   (line  49)
+* rand:                                  Numeric Functions.   (line  52)
 * random numbers, Cliff:                 Cliff Random Function.
                                                               (line   6)
 * random numbers, rand()/srand() functions: Numeric Functions.
-                                                              (line  49)
-* random numbers, seed of:               Numeric Functions.   (line  79)
+                                                              (line  52)
+* random numbers, seed of:               Numeric Functions.   (line  82)
 * range expressions (regexps):           Bracket Expressions. (line   6)
 * range patterns:                        Ranges.              (line   6)
 * range patterns, line continuation and: Ranges.              (line  64)
@@ -35070,7 +35073,7 @@ Index
 * sed utility:                           Full Line Fields.    (line  22)
 * sed utility <1>:                       Simple Sed.          (line   6)
 * sed utility <2>:                       Glossary.            (line  16)
-* seeding random number generator:       Numeric Functions.   (line  79)
+* seeding random number generator:       Numeric Functions.   (line  82)
 * semicolon (;), AWKPATH variable and:   PC Using.            (line   9)
 * semicolon (;), separating statements in actions: Statements/Lines.
                                                               (line  90)
@@ -35174,8 +35177,8 @@ Index
 * SIGUSR1 signal, for dynamic profiling: Profiling.           (line 186)
 * silent debugger command:               Debugger Execution Control.
                                                               (line  10)
-* sin:                                   Numeric Functions.   (line  90)
-* sine:                                  Numeric Functions.   (line  90)
+* sin:                                   Numeric Functions.   (line  93)
+* sine:                                  Numeric Functions.   (line  93)
 * single quote ('):                      One-shot.            (line  15)
 * single quote (') in gawk command lines: Long.               (line  35)
 * single quote ('), in shell commands:   Quoting.             (line  48)
@@ -35225,10 +35228,10 @@ Index
 * sprintf() function, OFMT variable and: User-modified.       (line 116)
 * sprintf() function, print/printf statements and: Round Function.
                                                               (line   6)
-* sqrt:                                  Numeric Functions.   (line  93)
+* sqrt:                                  Numeric Functions.   (line  96)
 * square brackets ([]), regexp operator: Regexp Operators.    (line  56)
-* square root:                           Numeric Functions.   (line  93)
-* srand:                                 Numeric Functions.   (line  97)
+* square root:                           Numeric Functions.   (line  96)
+* srand:                                 Numeric Functions.   (line 100)
 * stack frame:                           Debugging Terms.     (line  10)
 * Stallman, Richard:                     Manual History.      (line   6)
 * Stallman, Richard <1>:                 Acknowledgments.     (line  18)
@@ -35788,340 +35791,340 @@ Node: Functions516532
 Node: Built-in517570
 Node: Calling Built-in518651
 Node: Numeric Functions520647
-Ref: Numeric Functions-Footnote-1525480
-Ref: Numeric Functions-Footnote-2525837
-Ref: Numeric Functions-Footnote-3525885
-Node: String Functions526157
-Ref: String Functions-Footnote-1549815
-Ref: String Functions-Footnote-2549943
-Ref: String Functions-Footnote-3550191
-Node: Gory Details550278
-Ref: table-sub-escapes552069
-Ref: table-sub-proposed553588
-Ref: table-posix-sub554951
-Ref: table-gensub-escapes556492
-Ref: Gory Details-Footnote-1557315
-Node: I/O Functions557469
-Ref: table-system-return-values564051
-Ref: I/O Functions-Footnote-1566031
-Ref: I/O Functions-Footnote-2566179
-Node: Time Functions566299
-Ref: Time Functions-Footnote-1576966
-Ref: Time Functions-Footnote-2577034
-Ref: Time Functions-Footnote-3577192
-Ref: Time Functions-Footnote-4577303
-Ref: Time Functions-Footnote-5577415
-Ref: Time Functions-Footnote-6577642
-Node: Bitwise Functions577908
-Ref: table-bitwise-ops578502
-Ref: Bitwise Functions-Footnote-1584535
-Ref: Bitwise Functions-Footnote-2584708
-Node: Type Functions584899
-Node: I18N Functions587574
-Node: User-defined589225
-Node: Definition Syntax590030
-Ref: Definition Syntax-Footnote-1595717
-Node: Function Example595788
-Ref: Function Example-Footnote-1598710
-Node: Function Caveats598732
-Node: Calling A Function599250
-Node: Variable Scope600208
-Node: Pass By Value/Reference603202
-Node: Return Statement606701
-Node: Dynamic Typing609680
-Node: Indirect Calls610610
-Ref: Indirect Calls-Footnote-1620861
-Node: Functions Summary620989
-Node: Library Functions623694
-Ref: Library Functions-Footnote-1627301
-Ref: Library Functions-Footnote-2627444
-Node: Library Names627615
-Ref: Library Names-Footnote-1631075
-Ref: Library Names-Footnote-2631298
-Node: General Functions631384
-Node: Strtonum Function632487
-Node: Assert Function635509
-Node: Round Function638835
-Node: Cliff Random Function640376
-Node: Ordinal Functions641392
-Ref: Ordinal Functions-Footnote-1644455
-Ref: Ordinal Functions-Footnote-2644707
-Node: Join Function644917
-Ref: Join Function-Footnote-1646687
-Node: Getlocaltime Function646887
-Node: Readfile Function650629
-Node: Shell Quoting652601
-Node: Data File Management654002
-Node: Filetrans Function654634
-Node: Rewind Function658730
-Node: File Checking660636
-Ref: File Checking-Footnote-1661970
-Node: Empty Files662171
-Node: Ignoring Assigns664150
-Node: Getopt Function665700
-Ref: Getopt Function-Footnote-1677169
-Node: Passwd Functions677369
-Ref: Passwd Functions-Footnote-1686208
-Node: Group Functions686296
-Ref: Group Functions-Footnote-1694194
-Node: Walking Arrays694401
-Node: Library Functions Summary697409
-Node: Library Exercises698815
-Node: Sample Programs699280
-Node: Running Examples700050
-Node: Clones700778
-Node: Cut Program702002
-Node: Egrep Program711931
-Ref: Egrep Program-Footnote-1719443
-Node: Id Program719553
-Node: Split Program723233
-Ref: Split Program-Footnote-1726692
-Node: Tee Program726821
-Node: Uniq Program729611
-Node: Wc Program737037
-Ref: Wc Program-Footnote-1741292
-Node: Miscellaneous Programs741386
-Node: Dupword Program742599
-Node: Alarm Program744629
-Node: Translate Program749484
-Ref: Translate Program-Footnote-1754049
-Node: Labels Program754319
-Ref: Labels Program-Footnote-1757670
-Node: Word Sorting757754
-Node: History Sorting761826
-Node: Extract Program763661
-Node: Simple Sed771190
-Node: Igawk Program774264
-Ref: Igawk Program-Footnote-1788595
-Ref: Igawk Program-Footnote-2788797
-Ref: Igawk Program-Footnote-3788919
-Node: Anagram Program789034
-Node: Signature Program792096
-Node: Programs Summary793343
-Node: Programs Exercises794557
-Ref: Programs Exercises-Footnote-1798686
-Node: Advanced Features798777
-Node: Nondecimal Data800767
-Node: Array Sorting802358
-Node: Controlling Array Traversal803058
-Ref: Controlling Array Traversal-Footnote-1811425
-Node: Array Sorting Functions811543
-Ref: Array Sorting Functions-Footnote-1816634
-Node: Two-way I/O816830
-Ref: Two-way I/O-Footnote-1823381
-Ref: Two-way I/O-Footnote-2823568
-Node: TCP/IP Networking823650
-Node: Profiling826768
-Ref: Profiling-Footnote-1835440
-Node: Advanced Features Summary835763
-Node: Internationalization837607
-Node: I18N and L10N839087
-Node: Explaining gettext839774
-Ref: Explaining gettext-Footnote-1845666
-Ref: Explaining gettext-Footnote-2845851
-Node: Programmer i18n846016
-Ref: Programmer i18n-Footnote-1850965
-Node: Translator i18n851014
-Node: String Extraction851808
-Ref: String Extraction-Footnote-1852940
-Node: Printf Ordering853026
-Ref: Printf Ordering-Footnote-1855812
-Node: I18N Portability855876
-Ref: I18N Portability-Footnote-1858332
-Node: I18N Example858395
-Ref: I18N Example-Footnote-1861201
-Node: Gawk I18N861274
-Node: I18N Summary861919
-Node: Debugger863260
-Node: Debugging864282
-Node: Debugging Concepts864723
-Node: Debugging Terms866532
-Node: Awk Debugging869107
-Node: Sample Debugging Session870013
-Node: Debugger Invocation870547
-Node: Finding The Bug871933
-Node: List of Debugger Commands878411
-Node: Breakpoint Control879744
-Node: Debugger Execution Control883438
-Node: Viewing And Changing Data886800
-Node: Execution Stack890174
-Node: Debugger Info891811
-Node: Miscellaneous Debugger Commands895882
-Node: Readline Support900970
-Node: Limitations901866
-Node: Debugging Summary903975
-Node: Arbitrary Precision Arithmetic905254
-Node: Computer Arithmetic906670
-Ref: table-numeric-ranges910261
-Ref: Computer Arithmetic-Footnote-1910983
-Node: Math Definitions911040
-Ref: table-ieee-formats914354
-Ref: Math Definitions-Footnote-1914957
-Node: MPFR features915062
-Node: FP Math Caution916779
-Ref: FP Math Caution-Footnote-1917851
-Node: Inexactness of computations918220
-Node: Inexact representation919180
-Node: Comparing FP Values920540
-Node: Errors accumulate921622
-Node: Getting Accuracy923055
-Node: Try To Round925765
-Node: Setting precision926664
-Ref: table-predefined-precision-strings927361
-Node: Setting the rounding mode929191
-Ref: table-gawk-rounding-modes929565
-Ref: Setting the rounding mode-Footnote-1932973
-Node: Arbitrary Precision Integers933152
-Ref: Arbitrary Precision Integers-Footnote-1938069
-Node: POSIX Floating Point Problems938218
-Ref: POSIX Floating Point Problems-Footnote-1942100
-Node: Floating point summary942138
-Node: Dynamic Extensions944328
-Node: Extension Intro945881
-Node: Plugin License947147
-Node: Extension Mechanism Outline947944
-Ref: figure-load-extension948383
-Ref: figure-register-new-function949948
-Ref: figure-call-new-function951040
-Node: Extension API Description953102
-Node: Extension API Functions Introduction954744
-Node: General Data Types960078
-Ref: General Data Types-Footnote-1967283
-Node: Memory Allocation Functions967582
-Ref: Memory Allocation Functions-Footnote-1970427
-Node: Constructor Functions970526
-Node: Registration Functions973525
-Node: Extension Functions974210
-Node: Exit Callback Functions979423
-Node: Extension Version String980673
-Node: Input Parsers981336
-Node: Output Wrappers994043
-Node: Two-way processors998555
-Node: Printing Messages1000820
-Ref: Printing Messages-Footnote-11001991
-Node: Updating ERRNO1002144
-Node: Requesting Values1002883
-Ref: table-value-types-returned1003620
-Node: Accessing Parameters1004556
-Node: Symbol Table Access1005791
-Node: Symbol table by name1006303
-Node: Symbol table by cookie1008092
-Ref: Symbol table by cookie-Footnote-11012277
-Node: Cached values1012341
-Ref: Cached values-Footnote-11015877
-Node: Array Manipulation1015968
-Ref: Array Manipulation-Footnote-11017059
-Node: Array Data Types1017096
-Ref: Array Data Types-Footnote-11019754
-Node: Array Functions1019846
-Node: Flattening Arrays1024245
-Node: Creating Arrays1031186
-Node: Redirection API1035955
-Node: Extension API Variables1038797
-Node: Extension Versioning1039430
-Ref: gawk-api-version1039867
-Node: Extension API Informational Variables1041595
-Node: Extension API Boilerplate1042659
-Node: Changes from API V11046521
-Node: Finding Extensions1047181
-Node: Extension Example1047740
-Node: Internal File Description1048538
-Node: Internal File Ops1052618
-Ref: Internal File Ops-Footnote-11064018
-Node: Using Internal File Ops1064158
-Ref: Using Internal File Ops-Footnote-11066541
-Node: Extension Samples1066815
-Node: Extension Sample File Functions1068344
-Node: Extension Sample Fnmatch1075993
-Node: Extension Sample Fork1077480
-Node: Extension Sample Inplace1078698
-Node: Extension Sample Ord1081908
-Node: Extension Sample Readdir1082744
-Ref: table-readdir-file-types1083633
-Node: Extension Sample Revout1084438
-Node: Extension Sample Rev2way1085027
-Node: Extension Sample Read write array1085767
-Node: Extension Sample Readfile1087709
-Node: Extension Sample Time1088804
-Node: Extension Sample API Tests1090152
-Node: gawkextlib1090644
-Node: Extension summary1093091
-Node: Extension Exercises1096793
-Node: Language History1098291
-Node: V7/SVR3.11099947
-Node: SVR41102099
-Node: POSIX1103533
-Node: BTL1104912
-Node: POSIX/GNU1105641
-Node: Feature History1111533
-Node: Common Extensions1125903
-Node: Ranges and Locales1127186
-Ref: Ranges and Locales-Footnote-11131802
-Ref: Ranges and Locales-Footnote-21131829
-Ref: Ranges and Locales-Footnote-31132064
-Node: Contributors1132285
-Node: History summary1137845
-Node: Installation1139225
-Node: Gawk Distribution1140169
-Node: Getting1140653
-Node: Extracting1141614
-Node: Distribution contents1143252
-Node: Unix Installation1149594
-Node: Quick Installation1150276
-Node: Shell Startup Files1152690
-Node: Additional Configuration Options1153779
-Node: Configuration Philosophy1155584
-Node: Non-Unix Installation1157953
-Node: PC Installation1158413
-Node: PC Binary Installation1159251
-Node: PC Compiling1159686
-Node: PC Using1160803
-Node: Cygwin1163848
-Node: MSYS1164618
-Node: VMS Installation1165119
-Node: VMS Compilation1165910
-Ref: VMS Compilation-Footnote-11167139
-Node: VMS Dynamic Extensions1167197
-Node: VMS Installation Details1168882
-Node: VMS Running1171135
-Node: VMS GNV1175414
-Node: VMS Old Gawk1176149
-Node: Bugs1176620
-Node: Bug address1177283
-Node: Usenet1179680
-Node: Maintainers1180457
-Node: Other Versions1181833
-Node: Installation summary1188417
-Node: Notes1189452
-Node: Compatibility Mode1190317
-Node: Additions1191099
-Node: Accessing The Source1192024
-Node: Adding Code1193459
-Node: New Ports1199677
-Node: Derived Files1204165
-Ref: Derived Files-Footnote-11209650
-Ref: Derived Files-Footnote-21209685
-Ref: Derived Files-Footnote-31210283
-Node: Future Extensions1210397
-Node: Implementation Limitations1211055
-Node: Extension Design1212238
-Node: Old Extension Problems1213392
-Ref: Old Extension Problems-Footnote-11214910
-Node: Extension New Mechanism Goals1214967
-Ref: Extension New Mechanism Goals-Footnote-11218331
-Node: Extension Other Design Decisions1218520
-Node: Extension Future Growth1220633
-Node: Old Extension Mechanism1221469
-Node: Notes summary1223232
-Node: Basic Concepts1224414
-Node: Basic High Level1225095
-Ref: figure-general-flow1225377
-Ref: figure-process-flow1226062
-Ref: Basic High Level-Footnote-11229363
-Node: Basic Data Typing1229548
-Node: Glossary1232876
-Node: Copying1264823
-Node: GNU Free Documentation License1302362
-Node: Index1327480
+Ref: Numeric Functions-Footnote-1525592
+Ref: Numeric Functions-Footnote-2525949
+Ref: Numeric Functions-Footnote-3525997
+Node: String Functions526269
+Ref: String Functions-Footnote-1549927
+Ref: String Functions-Footnote-2550055
+Ref: String Functions-Footnote-3550303
+Node: Gory Details550390
+Ref: table-sub-escapes552181
+Ref: table-sub-proposed553700
+Ref: table-posix-sub555063
+Ref: table-gensub-escapes556604
+Ref: Gory Details-Footnote-1557427
+Node: I/O Functions557581
+Ref: table-system-return-values564163
+Ref: I/O Functions-Footnote-1566143
+Ref: I/O Functions-Footnote-2566291
+Node: Time Functions566411
+Ref: Time Functions-Footnote-1577078
+Ref: Time Functions-Footnote-2577146
+Ref: Time Functions-Footnote-3577304
+Ref: Time Functions-Footnote-4577415
+Ref: Time Functions-Footnote-5577527
+Ref: Time Functions-Footnote-6577754
+Node: Bitwise Functions578020
+Ref: table-bitwise-ops578614
+Ref: Bitwise Functions-Footnote-1584647
+Ref: Bitwise Functions-Footnote-2584820
+Node: Type Functions585011
+Node: I18N Functions587686
+Node: User-defined589337
+Node: Definition Syntax590142
+Ref: Definition Syntax-Footnote-1595829
+Node: Function Example595900
+Ref: Function Example-Footnote-1598822
+Node: Function Caveats598844
+Node: Calling A Function599362
+Node: Variable Scope600320
+Node: Pass By Value/Reference603314
+Node: Return Statement606813
+Node: Dynamic Typing609792
+Node: Indirect Calls610722
+Ref: Indirect Calls-Footnote-1620973
+Node: Functions Summary621101
+Node: Library Functions623806
+Ref: Library Functions-Footnote-1627413
+Ref: Library Functions-Footnote-2627556
+Node: Library Names627727
+Ref: Library Names-Footnote-1631187
+Ref: Library Names-Footnote-2631410
+Node: General Functions631496
+Node: Strtonum Function632599
+Node: Assert Function635621
+Node: Round Function638947
+Node: Cliff Random Function640488
+Node: Ordinal Functions641504
+Ref: Ordinal Functions-Footnote-1644567
+Ref: Ordinal Functions-Footnote-2644819
+Node: Join Function645029
+Ref: Join Function-Footnote-1646799
+Node: Getlocaltime Function646999
+Node: Readfile Function650741
+Node: Shell Quoting652713
+Node: Data File Management654114
+Node: Filetrans Function654746
+Node: Rewind Function658842
+Node: File Checking660748
+Ref: File Checking-Footnote-1662082
+Node: Empty Files662283
+Node: Ignoring Assigns664262
+Node: Getopt Function665812
+Ref: Getopt Function-Footnote-1677281
+Node: Passwd Functions677481
+Ref: Passwd Functions-Footnote-1686320
+Node: Group Functions686408
+Ref: Group Functions-Footnote-1694306
+Node: Walking Arrays694513
+Node: Library Functions Summary697521
+Node: Library Exercises698927
+Node: Sample Programs699392
+Node: Running Examples700162
+Node: Clones700890
+Node: Cut Program702114
+Node: Egrep Program712043
+Ref: Egrep Program-Footnote-1719555
+Node: Id Program719665
+Node: Split Program723345
+Ref: Split Program-Footnote-1726804
+Node: Tee Program726933
+Node: Uniq Program729723
+Node: Wc Program737149
+Ref: Wc Program-Footnote-1741404
+Node: Miscellaneous Programs741498
+Node: Dupword Program742711
+Node: Alarm Program744741
+Node: Translate Program749596
+Ref: Translate Program-Footnote-1754161
+Node: Labels Program754431
+Ref: Labels Program-Footnote-1757782
+Node: Word Sorting757866
+Node: History Sorting761938
+Node: Extract Program763773
+Node: Simple Sed771302
+Node: Igawk Program774376
+Ref: Igawk Program-Footnote-1788707
+Ref: Igawk Program-Footnote-2788909
+Ref: Igawk Program-Footnote-3789031
+Node: Anagram Program789146
+Node: Signature Program792208
+Node: Programs Summary793455
+Node: Programs Exercises794669
+Ref: Programs Exercises-Footnote-1798798
+Node: Advanced Features798889
+Node: Nondecimal Data800879
+Node: Array Sorting802470
+Node: Controlling Array Traversal803170
+Ref: Controlling Array Traversal-Footnote-1811537
+Node: Array Sorting Functions811655
+Ref: Array Sorting Functions-Footnote-1816746
+Node: Two-way I/O816942
+Ref: Two-way I/O-Footnote-1823493
+Ref: Two-way I/O-Footnote-2823680
+Node: TCP/IP Networking823762
+Node: Profiling826880
+Ref: Profiling-Footnote-1835552
+Node: Advanced Features Summary835875
+Node: Internationalization837719
+Node: I18N and L10N839199
+Node: Explaining gettext839886
+Ref: Explaining gettext-Footnote-1845778
+Ref: Explaining gettext-Footnote-2845963
+Node: Programmer i18n846128
+Ref: Programmer i18n-Footnote-1851077
+Node: Translator i18n851126
+Node: String Extraction851920
+Ref: String Extraction-Footnote-1853052
+Node: Printf Ordering853138
+Ref: Printf Ordering-Footnote-1855924
+Node: I18N Portability855988
+Ref: I18N Portability-Footnote-1858444
+Node: I18N Example858507
+Ref: I18N Example-Footnote-1861313
+Node: Gawk I18N861386
+Node: I18N Summary862031
+Node: Debugger863372
+Node: Debugging864394
+Node: Debugging Concepts864835
+Node: Debugging Terms866644
+Node: Awk Debugging869219
+Node: Sample Debugging Session870125
+Node: Debugger Invocation870659
+Node: Finding The Bug872045
+Node: List of Debugger Commands878523
+Node: Breakpoint Control879856
+Node: Debugger Execution Control883550
+Node: Viewing And Changing Data886912
+Node: Execution Stack890286
+Node: Debugger Info891923
+Node: Miscellaneous Debugger Commands895994
+Node: Readline Support901082
+Node: Limitations901978
+Node: Debugging Summary904087
+Node: Arbitrary Precision Arithmetic905366
+Node: Computer Arithmetic906782
+Ref: table-numeric-ranges910373
+Ref: Computer Arithmetic-Footnote-1911095
+Node: Math Definitions911152
+Ref: table-ieee-formats914466
+Ref: Math Definitions-Footnote-1915069
+Node: MPFR features915174
+Node: FP Math Caution916891
+Ref: FP Math Caution-Footnote-1917963
+Node: Inexactness of computations918332
+Node: Inexact representation919292
+Node: Comparing FP Values920652
+Node: Errors accumulate921734
+Node: Getting Accuracy923167
+Node: Try To Round925877
+Node: Setting precision926776
+Ref: table-predefined-precision-strings927473
+Node: Setting the rounding mode929303
+Ref: table-gawk-rounding-modes929677
+Ref: Setting the rounding mode-Footnote-1933085
+Node: Arbitrary Precision Integers933264
+Ref: Arbitrary Precision Integers-Footnote-1938181
+Node: POSIX Floating Point Problems938330
+Ref: POSIX Floating Point Problems-Footnote-1942212
+Node: Floating point summary942250
+Node: Dynamic Extensions944440
+Node: Extension Intro945993
+Node: Plugin License947259
+Node: Extension Mechanism Outline948056
+Ref: figure-load-extension948495
+Ref: figure-register-new-function950060
+Ref: figure-call-new-function951152
+Node: Extension API Description953214
+Node: Extension API Functions Introduction954856
+Node: General Data Types960190
+Ref: General Data Types-Footnote-1967395
+Node: Memory Allocation Functions967694
+Ref: Memory Allocation Functions-Footnote-1970539
+Node: Constructor Functions970638
+Node: Registration Functions973637
+Node: Extension Functions974322
+Node: Exit Callback Functions979535
+Node: Extension Version String980785
+Node: Input Parsers981448
+Node: Output Wrappers994155
+Node: Two-way processors998667
+Node: Printing Messages1000932
+Ref: Printing Messages-Footnote-11002103
+Node: Updating ERRNO1002256
+Node: Requesting Values1002995
+Ref: table-value-types-returned1003732
+Node: Accessing Parameters1004668
+Node: Symbol Table Access1005903
+Node: Symbol table by name1006415
+Node: Symbol table by cookie1008204
+Ref: Symbol table by cookie-Footnote-11012389
+Node: Cached values1012453
+Ref: Cached values-Footnote-11015989
+Node: Array Manipulation1016080
+Ref: Array Manipulation-Footnote-11017171
+Node: Array Data Types1017208
+Ref: Array Data Types-Footnote-11019866
+Node: Array Functions1019958
+Node: Flattening Arrays1024357
+Node: Creating Arrays1031298
+Node: Redirection API1036067
+Node: Extension API Variables1038909
+Node: Extension Versioning1039542
+Ref: gawk-api-version1039979
+Node: Extension API Informational Variables1041707
+Node: Extension API Boilerplate1042771
+Node: Changes from API V11046633
+Node: Finding Extensions1047293
+Node: Extension Example1047852
+Node: Internal File Description1048650
+Node: Internal File Ops1052730
+Ref: Internal File Ops-Footnote-11064130
+Node: Using Internal File Ops1064270
+Ref: Using Internal File Ops-Footnote-11066653
+Node: Extension Samples1066927
+Node: Extension Sample File Functions1068456
+Node: Extension Sample Fnmatch1076105
+Node: Extension Sample Fork1077592
+Node: Extension Sample Inplace1078810
+Node: Extension Sample Ord1082020
+Node: Extension Sample Readdir1082856
+Ref: table-readdir-file-types1083745
+Node: Extension Sample Revout1084550
+Node: Extension Sample Rev2way1085139
+Node: Extension Sample Read write array1085879
+Node: Extension Sample Readfile1087821
+Node: Extension Sample Time1088916
+Node: Extension Sample API Tests1090264
+Node: gawkextlib1090756
+Node: Extension summary1093203
+Node: Extension Exercises1096905
+Node: Language History1098403
+Node: V7/SVR3.11100059
+Node: SVR41102211
+Node: POSIX1103645
+Node: BTL1105024
+Node: POSIX/GNU1105753
+Node: Feature History1111645
+Node: Common Extensions1126015
+Node: Ranges and Locales1127298
+Ref: Ranges and Locales-Footnote-11131914
+Ref: Ranges and Locales-Footnote-21131941
+Ref: Ranges and Locales-Footnote-31132176
+Node: Contributors1132397
+Node: History summary1137957
+Node: Installation1139337
+Node: Gawk Distribution1140281
+Node: Getting1140765
+Node: Extracting1141726
+Node: Distribution contents1143364
+Node: Unix Installation1149706
+Node: Quick Installation1150388
+Node: Shell Startup Files1152802
+Node: Additional Configuration Options1153891
+Node: Configuration Philosophy1155696
+Node: Non-Unix Installation1158065
+Node: PC Installation1158525
+Node: PC Binary Installation1159363
+Node: PC Compiling1159798
+Node: PC Using1160915
+Node: Cygwin1163960
+Node: MSYS1164730
+Node: VMS Installation1165231
+Node: VMS Compilation1166022
+Ref: VMS Compilation-Footnote-11167251
+Node: VMS Dynamic Extensions1167309
+Node: VMS Installation Details1168994
+Node: VMS Running1171247
+Node: VMS GNV1175526
+Node: VMS Old Gawk1176261
+Node: Bugs1176732
+Node: Bug address1177395
+Node: Usenet1179792
+Node: Maintainers1180569
+Node: Other Versions1181945
+Node: Installation summary1188529
+Node: Notes1189564
+Node: Compatibility Mode1190429
+Node: Additions1191211
+Node: Accessing The Source1192136
+Node: Adding Code1193571
+Node: New Ports1199789
+Node: Derived Files1204277
+Ref: Derived Files-Footnote-11209762
+Ref: Derived Files-Footnote-21209797
+Ref: Derived Files-Footnote-31210395
+Node: Future Extensions1210509
+Node: Implementation Limitations1211167
+Node: Extension Design1212350
+Node: Old Extension Problems1213504
+Ref: Old Extension Problems-Footnote-11215022
+Node: Extension New Mechanism Goals1215079
+Ref: Extension New Mechanism Goals-Footnote-11218443
+Node: Extension Other Design Decisions1218632
+Node: Extension Future Growth1220745
+Node: Old Extension Mechanism1221581
+Node: Notes summary1223344
+Node: Basic Concepts1224526
+Node: Basic High Level1225207
+Ref: figure-general-flow1225489
+Ref: figure-process-flow1226174
+Ref: Basic High Level-Footnote-11229475
+Node: Basic Data Typing1229660
+Node: Glossary1232988
+Node: Copying1264935
+Node: GNU Free Documentation License1302474
+Node: Index1327592
 
 End Tag Table
diff --git a/doc/gawk.texi b/doc/gawk.texi
index 8b872e9..fa8c666 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -17461,13 +17461,17 @@ is @minus{}3, and @code{int(-3)} is @minus{}3 as well.
 @item @code{intdiv(@var{numerator}, @var{denominator}, @var{result})}
 @cindexawkfunc{intdiv}
 @cindex intdiv
-Perform integer division, similar to the standard C function of the
-same name.  First, truncate @code{numerator} and @code{denominator}
+Perform integer division, similar to the standard C @code{div()} function.
+First, truncate @code{numerator} and @code{denominator}
 towards zero, creating integer values.  Clear the @code{result}
 array, and then set @code{result["quotient"]} to the result of
 @samp{numerator / denominator}, truncated towards zero to an integer,
 and set @code{result["remainder"]} to the result of @samp{numerator %
-denominator}, truncated towards zero to an integer.  This function is
+denominator}, truncated towards zero to an integer.
+Attempting division by zero causes a fatal error.
+The function returns zero upon success, and @minus{}1 upon error.
+
+This function is
 primarily intended for use with arbitrary length integers; it avoids
 creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary
 Precision Integers}).
diff --git a/doc/gawktexi.in b/doc/gawktexi.in
index f991432..21c6e50 100644
--- a/doc/gawktexi.in
+++ b/doc/gawktexi.in
@@ -16734,13 +16734,17 @@ is @minus{}3, and @code{int(-3)} is @minus{}3 as well.
 @item @code{intdiv(@var{numerator}, @var{denominator}, @var{result})}
 @cindexawkfunc{intdiv}
 @cindex intdiv
-Perform integer division, similar to the standard C function of the
-same name.  First, truncate @code{numerator} and @code{denominator}
+Perform integer division, similar to the standard C @code{div()} function.
+First, truncate @code{numerator} and @code{denominator}
 towards zero, creating integer values.  Clear the @code{result}
 array, and then set @code{result["quotient"]} to the result of
 @samp{numerator / denominator}, truncated towards zero to an integer,
 and set @code{result["remainder"]} to the result of @samp{numerator %
-denominator}, truncated towards zero to an integer.  This function is
+denominator}, truncated towards zero to an integer.
+Attempting division by zero causes a fatal error.
+The function returns zero upon success, and @minus{}1 upon error.
+
+This function is
 primarily intended for use with arbitrary length integers; it avoids
 creating MPFR arbitrary precision floating-point values (@pxref{Arbitrary
 Precision Integers}).
diff --git a/mpfr.c b/mpfr.c
index 5a2a35d..c83a57b 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -1224,7 +1224,9 @@ do_mpfr_intdiv(int nargs)
        } else {
                if (! mpfr_number_p(numerator->mpg_numbr)) {
                        /* [+-]inf or NaN */
-                       return numerator;
+                       unref(numerator);
+                       unref(denominator);
+                       return make_number((AWKNUM) -1);
                }
 
                num = mpg_integer();
@@ -1237,7 +1239,10 @@ do_mpfr_intdiv(int nargs)
        } else {
                if (! mpfr_number_p(denominator->mpg_numbr)) {
                        /* [+-]inf or NaN */
-                       return denominator;
+                       unref(numerator);
+                       unref(denominator);
+                       unref(num);
+                       return make_number((AWKNUM) -1);
                }
 
                denom = mpg_integer();

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog       |   7 +
 builtin.c       |   3 +
 doc/ChangeLog   |   4 +
 doc/gawk.info   | 707 ++++++++++++++++++++++++++++----------------------------
 doc/gawk.texi   |  10 +-
 doc/gawktexi.in |  10 +-
 mpfr.c          |   9 +-
 7 files changed, 390 insertions(+), 360 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]