gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, long-double, updated. fddb32fc890cabd617


From: John Haque
Subject: [gawk-diffs] [SCM] gawk branch, long-double, updated. fddb32fc890cabd6175ab022302ca3d852a4731d
Date: Sat, 02 Feb 2013 10:30:32 +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, long-double has been updated
       via  fddb32fc890cabd6175ab022302ca3d852a4731d (commit)
       via  5f5c0c02c84012a4cb7f418ddb0ca2ec1b5db747 (commit)
       via  21e6675c65899a92c85c59da0711ec5375162dc7 (commit)
      from  a37db774455e596fa9c964a2e0f0fe73af47e221 (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=fddb32fc890cabd6175ab022302ca3d852a4731d

commit fddb32fc890cabd6175ab022302ca3d852a4731d
Author: John Haque <address@hidden>
Date:   Sat Feb 2 04:18:59 2013 -0600

    PREC and ROUNDMODE, missing math function replacements for long double.

diff --git a/awkgram.c b/awkgram.c
index 3156184..a3e421e 100644
--- a/awkgram.c
+++ b/awkgram.c
@@ -99,6 +99,9 @@ static int load_library(INSTRUCTION *file);
 static void next_sourcefile(void);
 static char *tokexpand(void);
 static bool is_deferred_variable(const char *name);
+#ifdef NUMDEBUG
+static NODE *do_default(int nargs);
+#endif
 
 #define instruction(t) bcalloc(t, 1, 0)
 
@@ -198,7 +201,7 @@ extern double fmod(double x, double y);
 #define is_identchar(c)                (isalnum(c) || (c) == '_')
 
 /* Line 371 of yacc.c  */
-#line 202 "awkgram.c"
+#line 205 "awkgram.c"
 
 # ifndef YY_NULL
 #  if defined __cplusplus && 201103L <= __cplusplus
@@ -367,7 +370,7 @@ int yyparse ();
 /* Copy the second part of user declarations.  */
 
 /* Line 390 of yacc.c  */
-#line 371 "awkgram.c"
+#line 374 "awkgram.c"
 
 #ifdef short
 # undef short
@@ -731,25 +734,25 @@ static const yytype_int16 yyrhs[] =
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   199,   199,   201,   206,   207,   213,   225,   229,   240,
-     246,   251,   259,   267,   269,   274,   282,   284,   290,   291,
-     293,   319,   330,   341,   347,   356,   366,   368,   370,   376,
-     381,   382,   386,   405,   404,   438,   440,   445,   446,   459,
-     464,   465,   469,   471,   473,   480,   570,   612,   654,   767,
-     774,   781,   791,   800,   809,   818,   829,   845,   844,   868,
-     880,   880,   978,   978,  1011,  1041,  1047,  1048,  1054,  1055,
-    1062,  1067,  1079,  1093,  1095,  1103,  1108,  1110,  1118,  1120,
-    1129,  1130,  1138,  1143,  1143,  1154,  1158,  1166,  1167,  1170,
-    1172,  1177,  1178,  1187,  1188,  1193,  1198,  1204,  1206,  1208,
-    1215,  1216,  1222,  1223,  1228,  1230,  1235,  1237,  1239,  1241,
-    1247,  1254,  1256,  1258,  1274,  1284,  1291,  1293,  1298,  1300,
-    1302,  1310,  1312,  1317,  1319,  1324,  1326,  1328,  1378,  1380,
-    1382,  1384,  1386,  1388,  1390,  1392,  1415,  1420,  1425,  1450,
-    1456,  1458,  1460,  1462,  1464,  1466,  1471,  1475,  1489,  1491,
-    1497,  1503,  1516,  1517,  1518,  1523,  1528,  1532,  1536,  1551,
-    1563,  1568,  1604,  1622,  1623,  1629,  1630,  1635,  1637,  1644,
-    1661,  1678,  1680,  1687,  1692,  1700,  1710,  1722,  1731,  1735,
-    1739,  1743,  1747,  1751,  1754,  1756,  1760,  1764,  1768
+       0,   202,   202,   204,   209,   210,   216,   228,   232,   243,
+     249,   254,   262,   270,   272,   277,   285,   287,   293,   294,
+     296,   322,   333,   344,   350,   359,   369,   371,   373,   379,
+     384,   385,   389,   408,   407,   441,   443,   448,   449,   462,
+     467,   468,   472,   474,   476,   483,   573,   615,   657,   770,
+     777,   784,   794,   803,   812,   821,   832,   848,   847,   871,
+     883,   883,   981,   981,  1014,  1044,  1050,  1051,  1057,  1058,
+    1065,  1070,  1082,  1096,  1098,  1106,  1111,  1113,  1121,  1123,
+    1132,  1133,  1141,  1146,  1146,  1157,  1161,  1169,  1170,  1173,
+    1175,  1180,  1181,  1190,  1191,  1196,  1201,  1207,  1209,  1211,
+    1218,  1219,  1225,  1226,  1231,  1233,  1238,  1240,  1242,  1244,
+    1250,  1257,  1259,  1261,  1277,  1287,  1294,  1296,  1301,  1303,
+    1305,  1313,  1315,  1320,  1322,  1327,  1329,  1331,  1381,  1383,
+    1385,  1387,  1389,  1391,  1393,  1395,  1418,  1423,  1428,  1453,
+    1459,  1461,  1463,  1465,  1467,  1469,  1474,  1478,  1492,  1494,
+    1500,  1506,  1519,  1520,  1521,  1526,  1531,  1535,  1539,  1554,
+    1566,  1571,  1607,  1625,  1626,  1632,  1633,  1638,  1640,  1647,
+    1664,  1681,  1683,  1690,  1695,  1703,  1713,  1725,  1734,  1738,
+    1742,  1746,  1750,  1754,  1757,  1759,  1763,  1767,  1771
 };
 #endif
 
@@ -2036,7 +2039,7 @@ yyreduce:
     {
         case 3:
 /* Line 1792 of yacc.c  */
-#line 202 "awkgram.y"
+#line 205 "awkgram.y"
     {
                rule = 0;
                yyerrok;
@@ -2045,7 +2048,7 @@ yyreduce:
 
   case 5:
 /* Line 1792 of yacc.c  */
-#line 208 "awkgram.y"
+#line 211 "awkgram.y"
     {
                next_sourcefile();
                if (sourcefile == srcfiles)
@@ -2055,7 +2058,7 @@ yyreduce:
 
   case 6:
 /* Line 1792 of yacc.c  */
-#line 214 "awkgram.y"
+#line 217 "awkgram.y"
     {
                rule = 0;
                /*
@@ -2068,7 +2071,7 @@ yyreduce:
 
   case 7:
 /* Line 1792 of yacc.c  */
-#line 226 "awkgram.y"
+#line 229 "awkgram.y"
     {
                (void) append_rule((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
          }
@@ -2076,7 +2079,7 @@ yyreduce:
 
   case 8:
 /* Line 1792 of yacc.c  */
-#line 230 "awkgram.y"
+#line 233 "awkgram.y"
     {
                if (rule != Rule) {
                        msg(_("%s blocks must have an action part"), 
ruletab[rule]);
@@ -2091,7 +2094,7 @@ yyreduce:
 
   case 9:
 /* Line 1792 of yacc.c  */
-#line 241 "awkgram.y"
+#line 244 "awkgram.y"
     {
                in_function = NULL;
                (void) mk_function((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
@@ -2101,7 +2104,7 @@ yyreduce:
 
   case 10:
 /* Line 1792 of yacc.c  */
-#line 247 "awkgram.y"
+#line 250 "awkgram.y"
     {
                want_source = false;
                yyerrok;
@@ -2110,7 +2113,7 @@ yyreduce:
 
   case 11:
 /* Line 1792 of yacc.c  */
-#line 252 "awkgram.y"
+#line 255 "awkgram.y"
     {
                want_source = false;
                yyerrok;
@@ -2119,7 +2122,7 @@ yyreduce:
 
   case 12:
 /* Line 1792 of yacc.c  */
-#line 260 "awkgram.y"
+#line 263 "awkgram.y"
     {
                if (include_source((yyvsp[(1) - (1)])) < 0)
                        YYABORT;
@@ -2131,19 +2134,19 @@ yyreduce:
 
   case 13:
 /* Line 1792 of yacc.c  */
-#line 268 "awkgram.y"
+#line 271 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 14:
 /* Line 1792 of yacc.c  */
-#line 270 "awkgram.y"
+#line 273 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 15:
 /* Line 1792 of yacc.c  */
-#line 275 "awkgram.y"
+#line 278 "awkgram.y"
     {
                if (load_library((yyvsp[(1) - (1)])) < 0)
                        YYABORT;
@@ -2155,31 +2158,31 @@ yyreduce:
 
   case 16:
 /* Line 1792 of yacc.c  */
-#line 283 "awkgram.y"
+#line 286 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 17:
 /* Line 1792 of yacc.c  */
-#line 285 "awkgram.y"
+#line 288 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 18:
 /* Line 1792 of yacc.c  */
-#line 290 "awkgram.y"
+#line 293 "awkgram.y"
     {  (yyval) = NULL; rule = Rule; }
     break;
 
   case 19:
 /* Line 1792 of yacc.c  */
-#line 292 "awkgram.y"
+#line 295 "awkgram.y"
     {  (yyval) = (yyvsp[(1) - (1)]); rule = Rule; }
     break;
 
   case 20:
 /* Line 1792 of yacc.c  */
-#line 294 "awkgram.y"
+#line 297 "awkgram.y"
     {
                INSTRUCTION *tp;
 
@@ -2209,7 +2212,7 @@ yyreduce:
 
   case 21:
 /* Line 1792 of yacc.c  */
-#line 320 "awkgram.y"
+#line 323 "awkgram.y"
     {
                static int begin_seen = 0;
                if (do_lint_old && ++begin_seen == 2)
@@ -2224,7 +2227,7 @@ yyreduce:
 
   case 22:
 /* Line 1792 of yacc.c  */
-#line 331 "awkgram.y"
+#line 334 "awkgram.y"
     {
                static int end_seen = 0;
                if (do_lint_old && ++end_seen == 2)
@@ -2239,7 +2242,7 @@ yyreduce:
 
   case 23:
 /* Line 1792 of yacc.c  */
-#line 342 "awkgram.y"
+#line 345 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->in_rule = rule = BEGINFILE;
                (yyvsp[(1) - (1)])->source_file = source;
@@ -2249,7 +2252,7 @@ yyreduce:
 
   case 24:
 /* Line 1792 of yacc.c  */
-#line 348 "awkgram.y"
+#line 351 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->in_rule = rule = ENDFILE;
                (yyvsp[(1) - (1)])->source_file = source;
@@ -2259,7 +2262,7 @@ yyreduce:
 
   case 25:
 /* Line 1792 of yacc.c  */
-#line 357 "awkgram.y"
+#line 360 "awkgram.y"
     {
                if ((yyvsp[(2) - (5)]) == NULL)
                        (yyval) = list_create(instruction(Op_no_op));
@@ -2270,19 +2273,19 @@ yyreduce:
 
   case 26:
 /* Line 1792 of yacc.c  */
-#line 367 "awkgram.y"
+#line 370 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 27:
 /* Line 1792 of yacc.c  */
-#line 369 "awkgram.y"
+#line 372 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 28:
 /* Line 1792 of yacc.c  */
-#line 371 "awkgram.y"
+#line 374 "awkgram.y"
     {
                yyerror(_("`%s' is a built-in function, it cannot be 
redefined"),
                                        tokstart);
@@ -2292,13 +2295,13 @@ yyreduce:
 
   case 29:
 /* Line 1792 of yacc.c  */
-#line 377 "awkgram.y"
+#line 380 "awkgram.y"
     { (yyval) = (yyvsp[(2) - (2)]); }
     break;
 
   case 32:
 /* Line 1792 of yacc.c  */
-#line 387 "awkgram.y"
+#line 390 "awkgram.y"
     {
                (yyvsp[(1) - (6)])->source_file = source;
                if (install_function((yyvsp[(2) - (6)])->lextok, (yyvsp[(1) - 
(6)]), (yyvsp[(4) - (6)])) < 0)
@@ -2313,13 +2316,13 @@ yyreduce:
 
   case 33:
 /* Line 1792 of yacc.c  */
-#line 405 "awkgram.y"
+#line 408 "awkgram.y"
     { want_regexp = true; }
     break;
 
   case 34:
 /* Line 1792 of yacc.c  */
-#line 407 "awkgram.y"
+#line 410 "awkgram.y"
     {
                  NODE *n, *exp;
                  char *re;
@@ -2352,19 +2355,19 @@ yyreduce:
 
   case 35:
 /* Line 1792 of yacc.c  */
-#line 439 "awkgram.y"
+#line 442 "awkgram.y"
     { bcfree((yyvsp[(1) - (1)])); }
     break;
 
   case 37:
 /* Line 1792 of yacc.c  */
-#line 445 "awkgram.y"
+#line 448 "awkgram.y"
     {  (yyval) = NULL; }
     break;
 
   case 38:
 /* Line 1792 of yacc.c  */
-#line 447 "awkgram.y"
+#line 450 "awkgram.y"
     {
                if ((yyvsp[(2) - (2)]) == NULL)
                        (yyval) = (yyvsp[(1) - (2)]);
@@ -2381,25 +2384,25 @@ yyreduce:
 
   case 39:
 /* Line 1792 of yacc.c  */
-#line 460 "awkgram.y"
+#line 463 "awkgram.y"
     {  (yyval) = NULL; }
     break;
 
   case 42:
 /* Line 1792 of yacc.c  */
-#line 470 "awkgram.y"
+#line 473 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 43:
 /* Line 1792 of yacc.c  */
-#line 472 "awkgram.y"
+#line 475 "awkgram.y"
     { (yyval) = (yyvsp[(2) - (3)]); }
     break;
 
   case 44:
 /* Line 1792 of yacc.c  */
-#line 474 "awkgram.y"
+#line 477 "awkgram.y"
     {
                if (do_pretty_print)
                        (yyval) = list_prepend((yyvsp[(1) - (1)]), 
instruction(Op_exec_count));
@@ -2410,7 +2413,7 @@ yyreduce:
 
   case 45:
 /* Line 1792 of yacc.c  */
-#line 481 "awkgram.y"
+#line 484 "awkgram.y"
     {
                INSTRUCTION *dflt, *curr = NULL, *cexp, *cstmt;
                INSTRUCTION *ip, *nextc, *tbreak;
@@ -2504,7 +2507,7 @@ yyreduce:
 
   case 46:
 /* Line 1792 of yacc.c  */
-#line 571 "awkgram.y"
+#line 574 "awkgram.y"
     { 
                /*
                 *    -----------------
@@ -2550,7 +2553,7 @@ yyreduce:
 
   case 47:
 /* Line 1792 of yacc.c  */
-#line 613 "awkgram.y"
+#line 616 "awkgram.y"
     {
                /*
                 *    -----------------
@@ -2596,7 +2599,7 @@ yyreduce:
 
   case 48:
 /* Line 1792 of yacc.c  */
-#line 655 "awkgram.y"
+#line 658 "awkgram.y"
     {
                INSTRUCTION *ip;
                char *var_name = (yyvsp[(3) - (8)])->lextok;
@@ -2713,7 +2716,7 @@ regular_loop:
 
   case 49:
 /* Line 1792 of yacc.c  */
-#line 768 "awkgram.y"
+#line 771 "awkgram.y"
     {
                (yyval) = mk_for_loop((yyvsp[(1) - (12)]), (yyvsp[(3) - (12)]), 
(yyvsp[(6) - (12)]), (yyvsp[(9) - (12)]), (yyvsp[(12) - (12)]));
 
@@ -2724,7 +2727,7 @@ regular_loop:
 
   case 50:
 /* Line 1792 of yacc.c  */
-#line 775 "awkgram.y"
+#line 778 "awkgram.y"
     {
                (yyval) = mk_for_loop((yyvsp[(1) - (11)]), (yyvsp[(3) - (11)]), 
(INSTRUCTION *) NULL, (yyvsp[(8) - (11)]), (yyvsp[(11) - (11)]));
 
@@ -2735,7 +2738,7 @@ regular_loop:
 
   case 51:
 /* Line 1792 of yacc.c  */
-#line 782 "awkgram.y"
+#line 785 "awkgram.y"
     {
                if (do_pretty_print)
                        (yyval) = list_prepend((yyvsp[(1) - (1)]), 
instruction(Op_exec_count));
@@ -2746,7 +2749,7 @@ regular_loop:
 
   case 52:
 /* Line 1792 of yacc.c  */
-#line 792 "awkgram.y"
+#line 795 "awkgram.y"
     { 
                if (! break_allowed)
                        error_ln((yyvsp[(1) - (2)])->source_line,
@@ -2759,7 +2762,7 @@ regular_loop:
 
   case 53:
 /* Line 1792 of yacc.c  */
-#line 801 "awkgram.y"
+#line 804 "awkgram.y"
     {
                if (! continue_allowed)
                        error_ln((yyvsp[(1) - (2)])->source_line,
@@ -2772,7 +2775,7 @@ regular_loop:
 
   case 54:
 /* Line 1792 of yacc.c  */
-#line 810 "awkgram.y"
+#line 813 "awkgram.y"
     {
                /* if inside function (rule = 0), resolve context at run-time */
                if (rule && rule != Rule)
@@ -2785,7 +2788,7 @@ regular_loop:
 
   case 55:
 /* Line 1792 of yacc.c  */
-#line 819 "awkgram.y"
+#line 822 "awkgram.y"
     {
                /* if inside function (rule = 0), resolve context at run-time */
                if (rule == BEGIN || rule == END || rule == ENDFILE)
@@ -2800,7 +2803,7 @@ regular_loop:
 
   case 56:
 /* Line 1792 of yacc.c  */
-#line 830 "awkgram.y"
+#line 833 "awkgram.y"
     {
                /* Initialize the two possible jump targets, the actual target
                 * is resolved at run-time. 
@@ -2819,7 +2822,7 @@ regular_loop:
 
   case 57:
 /* Line 1792 of yacc.c  */
-#line 845 "awkgram.y"
+#line 848 "awkgram.y"
     {
                if (! in_function)
                        yyerror(_("`return' used outside function context"));
@@ -2828,7 +2831,7 @@ regular_loop:
 
   case 58:
 /* Line 1792 of yacc.c  */
-#line 848 "awkgram.y"
+#line 851 "awkgram.y"
     {
                if ((yyvsp[(3) - (4)]) == NULL) {
                        (yyval) = list_create((yyvsp[(1) - (4)]));
@@ -2853,13 +2856,13 @@ regular_loop:
 
   case 60:
 /* Line 1792 of yacc.c  */
-#line 880 "awkgram.y"
+#line 883 "awkgram.y"
     { in_print = true; in_parens = 0; }
     break;
 
   case 61:
 /* Line 1792 of yacc.c  */
-#line 881 "awkgram.y"
+#line 884 "awkgram.y"
     {
                /*
                 * Optimization: plain `print' has no expression list, so $3 is 
null.
@@ -2960,13 +2963,13 @@ regular_print:
 
   case 62:
 /* Line 1792 of yacc.c  */
-#line 978 "awkgram.y"
+#line 981 "awkgram.y"
     { sub_counter = 0; }
     break;
 
   case 63:
 /* Line 1792 of yacc.c  */
-#line 979 "awkgram.y"
+#line 982 "awkgram.y"
     {
                char *arr = (yyvsp[(2) - (4)])->lextok;
 
@@ -3003,7 +3006,7 @@ regular_print:
 
   case 64:
 /* Line 1792 of yacc.c  */
-#line 1016 "awkgram.y"
+#line 1019 "awkgram.y"
     {
                static bool warned = false;
                char *arr = (yyvsp[(3) - (4)])->lextok;
@@ -3033,31 +3036,31 @@ regular_print:
 
   case 65:
 /* Line 1792 of yacc.c  */
-#line 1042 "awkgram.y"
+#line 1045 "awkgram.y"
     {  (yyval) = optimize_assignment((yyvsp[(1) - (1)])); }
     break;
 
   case 66:
 /* Line 1792 of yacc.c  */
-#line 1047 "awkgram.y"
+#line 1050 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 67:
 /* Line 1792 of yacc.c  */
-#line 1049 "awkgram.y"
+#line 1052 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 68:
 /* Line 1792 of yacc.c  */
-#line 1054 "awkgram.y"
+#line 1057 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 69:
 /* Line 1792 of yacc.c  */
-#line 1056 "awkgram.y"
+#line 1059 "awkgram.y"
     {
                if ((yyvsp[(1) - (2)]) == NULL)
                        (yyval) = list_create((yyvsp[(2) - (2)]));
@@ -3068,13 +3071,13 @@ regular_print:
 
   case 70:
 /* Line 1792 of yacc.c  */
-#line 1063 "awkgram.y"
+#line 1066 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 71:
 /* Line 1792 of yacc.c  */
-#line 1068 "awkgram.y"
+#line 1071 "awkgram.y"
     {
                INSTRUCTION *casestmt = (yyvsp[(5) - (5)]);
                if ((yyvsp[(5) - (5)]) == NULL)
@@ -3090,7 +3093,7 @@ regular_print:
 
   case 72:
 /* Line 1792 of yacc.c  */
-#line 1080 "awkgram.y"
+#line 1083 "awkgram.y"
     {
                INSTRUCTION *casestmt = (yyvsp[(4) - (4)]);
                if ((yyvsp[(4) - (4)]) == NULL)
@@ -3105,13 +3108,13 @@ regular_print:
 
   case 73:
 /* Line 1792 of yacc.c  */
-#line 1094 "awkgram.y"
+#line 1097 "awkgram.y"
     {  (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 74:
 /* Line 1792 of yacc.c  */
-#line 1096 "awkgram.y"
+#line 1099 "awkgram.y"
     { 
                NODE *n = (yyvsp[(2) - (2)])->memory;
                (void) force_number(n);
@@ -3123,7 +3126,7 @@ regular_print:
 
   case 75:
 /* Line 1792 of yacc.c  */
-#line 1104 "awkgram.y"
+#line 1107 "awkgram.y"
     {
                bcfree((yyvsp[(1) - (2)]));
                (yyval) = (yyvsp[(2) - (2)]);
@@ -3132,13 +3135,13 @@ regular_print:
 
   case 76:
 /* Line 1792 of yacc.c  */
-#line 1109 "awkgram.y"
+#line 1112 "awkgram.y"
     {  (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 77:
 /* Line 1792 of yacc.c  */
-#line 1111 "awkgram.y"
+#line 1114 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->opcode = Op_push_re;
                (yyval) = (yyvsp[(1) - (1)]);
@@ -3147,19 +3150,19 @@ regular_print:
 
   case 78:
 /* Line 1792 of yacc.c  */
-#line 1119 "awkgram.y"
+#line 1122 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 79:
 /* Line 1792 of yacc.c  */
-#line 1121 "awkgram.y"
+#line 1124 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 81:
 /* Line 1792 of yacc.c  */
-#line 1131 "awkgram.y"
+#line 1134 "awkgram.y"
     {
                (yyval) = (yyvsp[(2) - (3)]);
          }
@@ -3167,7 +3170,7 @@ regular_print:
 
   case 82:
 /* Line 1792 of yacc.c  */
-#line 1138 "awkgram.y"
+#line 1141 "awkgram.y"
     {
                in_print = false;
                in_parens = 0;
@@ -3177,13 +3180,13 @@ regular_print:
 
   case 83:
 /* Line 1792 of yacc.c  */
-#line 1143 "awkgram.y"
+#line 1146 "awkgram.y"
     { in_print = false; in_parens = 0; }
     break;
 
   case 84:
 /* Line 1792 of yacc.c  */
-#line 1144 "awkgram.y"
+#line 1147 "awkgram.y"
     {
                if ((yyvsp[(1) - (3)])->redir_type == redirect_twoway
                        && (yyvsp[(3) - (3)])->lasti->opcode == 
Op_K_getline_redir
@@ -3195,7 +3198,7 @@ regular_print:
 
   case 85:
 /* Line 1792 of yacc.c  */
-#line 1155 "awkgram.y"
+#line 1158 "awkgram.y"
     {
                (yyval) = mk_condition((yyvsp[(3) - (6)]), (yyvsp[(1) - (6)]), 
(yyvsp[(6) - (6)]), NULL, NULL);
          }
@@ -3203,7 +3206,7 @@ regular_print:
 
   case 86:
 /* Line 1792 of yacc.c  */
-#line 1160 "awkgram.y"
+#line 1163 "awkgram.y"
     {
                (yyval) = mk_condition((yyvsp[(3) - (9)]), (yyvsp[(1) - (9)]), 
(yyvsp[(6) - (9)]), (yyvsp[(7) - (9)]), (yyvsp[(9) - (9)]));
          }
@@ -3211,13 +3214,13 @@ regular_print:
 
   case 91:
 /* Line 1792 of yacc.c  */
-#line 1177 "awkgram.y"
+#line 1180 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 92:
 /* Line 1792 of yacc.c  */
-#line 1179 "awkgram.y"
+#line 1182 "awkgram.y"
     {
                bcfree((yyvsp[(1) - (2)]));
                (yyval) = (yyvsp[(2) - (2)]);
@@ -3226,19 +3229,19 @@ regular_print:
 
   case 93:
 /* Line 1792 of yacc.c  */
-#line 1187 "awkgram.y"
+#line 1190 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 94:
 /* Line 1792 of yacc.c  */
-#line 1189 "awkgram.y"
+#line 1192 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]) ; }
     break;
 
   case 95:
 /* Line 1792 of yacc.c  */
-#line 1194 "awkgram.y"
+#line 1197 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->param_count = 0;
                (yyval) = list_create((yyvsp[(1) - (1)]));
@@ -3247,7 +3250,7 @@ regular_print:
 
   case 96:
 /* Line 1792 of yacc.c  */
-#line 1199 "awkgram.y"
+#line 1202 "awkgram.y"
     {
                (yyvsp[(3) - (3)])->param_count =  (yyvsp[(1) - 
(3)])->lasti->param_count + 1;
                (yyval) = list_append((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]));
@@ -3257,55 +3260,55 @@ regular_print:
 
   case 97:
 /* Line 1792 of yacc.c  */
-#line 1205 "awkgram.y"
+#line 1208 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 98:
 /* Line 1792 of yacc.c  */
-#line 1207 "awkgram.y"
+#line 1210 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (2)]); }
     break;
 
   case 99:
 /* Line 1792 of yacc.c  */
-#line 1209 "awkgram.y"
+#line 1212 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (3)]); }
     break;
 
   case 100:
 /* Line 1792 of yacc.c  */
-#line 1215 "awkgram.y"
+#line 1218 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 101:
 /* Line 1792 of yacc.c  */
-#line 1217 "awkgram.y"
+#line 1220 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 102:
 /* Line 1792 of yacc.c  */
-#line 1222 "awkgram.y"
+#line 1225 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 103:
 /* Line 1792 of yacc.c  */
-#line 1224 "awkgram.y"
+#line 1227 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 104:
 /* Line 1792 of yacc.c  */
-#line 1229 "awkgram.y"
+#line 1232 "awkgram.y"
     {  (yyval) = mk_expression_list(NULL, (yyvsp[(1) - (1)])); }
     break;
 
   case 105:
 /* Line 1792 of yacc.c  */
-#line 1231 "awkgram.y"
+#line 1234 "awkgram.y"
     {
                (yyval) = mk_expression_list((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)]));
                yyerrok;
@@ -3314,31 +3317,31 @@ regular_print:
 
   case 106:
 /* Line 1792 of yacc.c  */
-#line 1236 "awkgram.y"
+#line 1239 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 107:
 /* Line 1792 of yacc.c  */
-#line 1238 "awkgram.y"
+#line 1241 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 108:
 /* Line 1792 of yacc.c  */
-#line 1240 "awkgram.y"
+#line 1243 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 109:
 /* Line 1792 of yacc.c  */
-#line 1242 "awkgram.y"
+#line 1245 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 110:
 /* Line 1792 of yacc.c  */
-#line 1248 "awkgram.y"
+#line 1251 "awkgram.y"
     {
                if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == 
Op_match_rec)
                        lintwarn_ln((yyvsp[(2) - (3)])->source_line,
@@ -3349,19 +3352,19 @@ regular_print:
 
   case 111:
 /* Line 1792 of yacc.c  */
-#line 1255 "awkgram.y"
+#line 1258 "awkgram.y"
     {  (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) 
- (3)])); }
     break;
 
   case 112:
 /* Line 1792 of yacc.c  */
-#line 1257 "awkgram.y"
+#line 1260 "awkgram.y"
     {  (yyval) = mk_boolean((yyvsp[(1) - (3)]), (yyvsp[(3) - (3)]), (yyvsp[(2) 
- (3)])); }
     break;
 
   case 113:
 /* Line 1792 of yacc.c  */
-#line 1259 "awkgram.y"
+#line 1262 "awkgram.y"
     {
                if ((yyvsp[(1) - (3)])->lasti->opcode == Op_match_rec)
                        warning_ln((yyvsp[(2) - (3)])->source_line,
@@ -3381,7 +3384,7 @@ regular_print:
 
   case 114:
 /* Line 1792 of yacc.c  */
-#line 1275 "awkgram.y"
+#line 1278 "awkgram.y"
     {
                if (do_lint_old)
                        warning_ln((yyvsp[(2) - (3)])->source_line,
@@ -3395,7 +3398,7 @@ regular_print:
 
   case 115:
 /* Line 1792 of yacc.c  */
-#line 1285 "awkgram.y"
+#line 1288 "awkgram.y"
     {
                if (do_lint && (yyvsp[(3) - (3)])->lasti->opcode == 
Op_match_rec)
                        lintwarn_ln((yyvsp[(2) - (3)])->source_line,
@@ -3406,31 +3409,31 @@ regular_print:
 
   case 116:
 /* Line 1792 of yacc.c  */
-#line 1292 "awkgram.y"
+#line 1295 "awkgram.y"
     { (yyval) = mk_condition((yyvsp[(1) - (5)]), (yyvsp[(2) - (5)]), 
(yyvsp[(3) - (5)]), (yyvsp[(4) - (5)]), (yyvsp[(5) - (5)])); }
     break;
 
   case 117:
 /* Line 1792 of yacc.c  */
-#line 1294 "awkgram.y"
+#line 1297 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 118:
 /* Line 1792 of yacc.c  */
-#line 1299 "awkgram.y"
+#line 1302 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 119:
 /* Line 1792 of yacc.c  */
-#line 1301 "awkgram.y"
+#line 1304 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 120:
 /* Line 1792 of yacc.c  */
-#line 1303 "awkgram.y"
+#line 1306 "awkgram.y"
     {  
                (yyvsp[(2) - (2)])->opcode = Op_assign_quotient;
                (yyval) = (yyvsp[(2) - (2)]);
@@ -3439,43 +3442,43 @@ regular_print:
 
   case 121:
 /* Line 1792 of yacc.c  */
-#line 1311 "awkgram.y"
+#line 1314 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 122:
 /* Line 1792 of yacc.c  */
-#line 1313 "awkgram.y"
+#line 1316 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 123:
 /* Line 1792 of yacc.c  */
-#line 1318 "awkgram.y"
+#line 1321 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 124:
 /* Line 1792 of yacc.c  */
-#line 1320 "awkgram.y"
+#line 1323 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 125:
 /* Line 1792 of yacc.c  */
-#line 1325 "awkgram.y"
+#line 1328 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 126:
 /* Line 1792 of yacc.c  */
-#line 1327 "awkgram.y"
+#line 1330 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 127:
 /* Line 1792 of yacc.c  */
-#line 1329 "awkgram.y"
+#line 1332 "awkgram.y"
     {
                int count = 2;
                bool is_simple_var = false;
@@ -3526,43 +3529,43 @@ regular_print:
 
   case 129:
 /* Line 1792 of yacc.c  */
-#line 1381 "awkgram.y"
+#line 1384 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 130:
 /* Line 1792 of yacc.c  */
-#line 1383 "awkgram.y"
+#line 1386 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 131:
 /* Line 1792 of yacc.c  */
-#line 1385 "awkgram.y"
+#line 1388 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 132:
 /* Line 1792 of yacc.c  */
-#line 1387 "awkgram.y"
+#line 1390 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 133:
 /* Line 1792 of yacc.c  */
-#line 1389 "awkgram.y"
+#line 1392 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 134:
 /* Line 1792 of yacc.c  */
-#line 1391 "awkgram.y"
+#line 1394 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 135:
 /* Line 1792 of yacc.c  */
-#line 1393 "awkgram.y"
+#line 1396 "awkgram.y"
     {
                /*
                 * In BEGINFILE/ENDFILE, allow `getline var < file'
@@ -3589,7 +3592,7 @@ regular_print:
 
   case 136:
 /* Line 1792 of yacc.c  */
-#line 1416 "awkgram.y"
+#line 1419 "awkgram.y"
     {
                (yyvsp[(2) - (2)])->opcode = Op_postincrement;
                (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - 
(2)]));
@@ -3598,7 +3601,7 @@ regular_print:
 
   case 137:
 /* Line 1792 of yacc.c  */
-#line 1421 "awkgram.y"
+#line 1424 "awkgram.y"
     {
                (yyvsp[(2) - (2)])->opcode = Op_postdecrement;
                (yyval) = mk_assignment((yyvsp[(1) - (2)]), NULL, (yyvsp[(2) - 
(2)]));
@@ -3607,7 +3610,7 @@ regular_print:
 
   case 138:
 /* Line 1792 of yacc.c  */
-#line 1426 "awkgram.y"
+#line 1429 "awkgram.y"
     {
                if (do_lint_old) {
                    warning_ln((yyvsp[(4) - (5)])->source_line,
@@ -3631,7 +3634,7 @@ regular_print:
 
   case 139:
 /* Line 1792 of yacc.c  */
-#line 1451 "awkgram.y"
+#line 1454 "awkgram.y"
     {
                  (yyval) = mk_getline((yyvsp[(3) - (4)]), (yyvsp[(4) - (4)]), 
(yyvsp[(1) - (4)]), (yyvsp[(2) - (4)])->redir_type);
                  bcfree((yyvsp[(2) - (4)]));
@@ -3640,43 +3643,43 @@ regular_print:
 
   case 140:
 /* Line 1792 of yacc.c  */
-#line 1457 "awkgram.y"
+#line 1460 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 141:
 /* Line 1792 of yacc.c  */
-#line 1459 "awkgram.y"
+#line 1462 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 142:
 /* Line 1792 of yacc.c  */
-#line 1461 "awkgram.y"
+#line 1464 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 143:
 /* Line 1792 of yacc.c  */
-#line 1463 "awkgram.y"
+#line 1466 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 144:
 /* Line 1792 of yacc.c  */
-#line 1465 "awkgram.y"
+#line 1468 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 145:
 /* Line 1792 of yacc.c  */
-#line 1467 "awkgram.y"
+#line 1470 "awkgram.y"
     {  (yyval) = list_append(list_merge((yyvsp[(1) - (3)]), (yyvsp[(3) - 
(3)])), (yyvsp[(2) - (3)])); }
     break;
 
   case 146:
 /* Line 1792 of yacc.c  */
-#line 1472 "awkgram.y"
+#line 1475 "awkgram.y"
     {
                (yyval) = list_create((yyvsp[(1) - (1)]));
          }
@@ -3684,7 +3687,7 @@ regular_print:
 
   case 147:
 /* Line 1792 of yacc.c  */
-#line 1476 "awkgram.y"
+#line 1479 "awkgram.y"
     {
                if ((yyvsp[(2) - (2)])->opcode == Op_match_rec) {
                        (yyvsp[(2) - (2)])->opcode = Op_nomatch;
@@ -3702,13 +3705,13 @@ regular_print:
 
   case 148:
 /* Line 1792 of yacc.c  */
-#line 1490 "awkgram.y"
+#line 1493 "awkgram.y"
     { (yyval) = (yyvsp[(2) - (3)]); }
     break;
 
   case 149:
 /* Line 1792 of yacc.c  */
-#line 1492 "awkgram.y"
+#line 1495 "awkgram.y"
     {
                (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
                if ((yyval) == NULL)
@@ -3718,7 +3721,7 @@ regular_print:
 
   case 150:
 /* Line 1792 of yacc.c  */
-#line 1498 "awkgram.y"
+#line 1501 "awkgram.y"
     {
                (yyval) = snode((yyvsp[(3) - (4)]), (yyvsp[(1) - (4)]));
                if ((yyval) == NULL)
@@ -3728,7 +3731,7 @@ regular_print:
 
   case 151:
 /* Line 1792 of yacc.c  */
-#line 1504 "awkgram.y"
+#line 1507 "awkgram.y"
     {
                static bool warned = false;
 
@@ -3745,7 +3748,7 @@ regular_print:
 
   case 154:
 /* Line 1792 of yacc.c  */
-#line 1519 "awkgram.y"
+#line 1522 "awkgram.y"
     {
                (yyvsp[(1) - (2)])->opcode = Op_preincrement;
                (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - 
(2)]));
@@ -3754,7 +3757,7 @@ regular_print:
 
   case 155:
 /* Line 1792 of yacc.c  */
-#line 1524 "awkgram.y"
+#line 1527 "awkgram.y"
     {
                (yyvsp[(1) - (2)])->opcode = Op_predecrement;
                (yyval) = mk_assignment((yyvsp[(2) - (2)]), NULL, (yyvsp[(1) - 
(2)]));
@@ -3763,7 +3766,7 @@ regular_print:
 
   case 156:
 /* Line 1792 of yacc.c  */
-#line 1529 "awkgram.y"
+#line 1532 "awkgram.y"
     {
                (yyval) = list_create((yyvsp[(1) - (1)]));
          }
@@ -3771,7 +3774,7 @@ regular_print:
 
   case 157:
 /* Line 1792 of yacc.c  */
-#line 1533 "awkgram.y"
+#line 1536 "awkgram.y"
     {
                (yyval) = list_create((yyvsp[(1) - (1)]));
          }
@@ -3779,7 +3782,7 @@ regular_print:
 
   case 158:
 /* Line 1792 of yacc.c  */
-#line 1537 "awkgram.y"
+#line 1540 "awkgram.y"
     {
                if ((yyvsp[(2) - (2)])->lasti->opcode == Op_push_i
                        && ((yyvsp[(2) - (2)])->lasti->memory->flags & 
(STRCUR|STRING)) == 0
@@ -3798,7 +3801,7 @@ regular_print:
 
   case 159:
 /* Line 1792 of yacc.c  */
-#line 1552 "awkgram.y"
+#line 1555 "awkgram.y"
     {
            /*
             * was: $$ = $2
@@ -3811,7 +3814,7 @@ regular_print:
 
   case 160:
 /* Line 1792 of yacc.c  */
-#line 1564 "awkgram.y"
+#line 1567 "awkgram.y"
     {
                func_use((yyvsp[(1) - (1)])->lasti->func_name, FUNC_USE);
                (yyval) = (yyvsp[(1) - (1)]);
@@ -3820,7 +3823,7 @@ regular_print:
 
   case 161:
 /* Line 1792 of yacc.c  */
-#line 1569 "awkgram.y"
+#line 1572 "awkgram.y"
     {
                /* indirect function call */
                INSTRUCTION *f, *t;
@@ -3857,7 +3860,7 @@ regular_print:
 
   case 162:
 /* Line 1792 of yacc.c  */
-#line 1605 "awkgram.y"
+#line 1608 "awkgram.y"
     {
                param_sanity((yyvsp[(3) - (4)]));
                (yyvsp[(1) - (4)])->opcode = Op_func_call;
@@ -3875,37 +3878,37 @@ regular_print:
 
   case 163:
 /* Line 1792 of yacc.c  */
-#line 1622 "awkgram.y"
+#line 1625 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 164:
 /* Line 1792 of yacc.c  */
-#line 1624 "awkgram.y"
+#line 1627 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 165:
 /* Line 1792 of yacc.c  */
-#line 1629 "awkgram.y"
+#line 1632 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 166:
 /* Line 1792 of yacc.c  */
-#line 1631 "awkgram.y"
+#line 1634 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (2)]); }
     break;
 
   case 167:
 /* Line 1792 of yacc.c  */
-#line 1636 "awkgram.y"
+#line 1639 "awkgram.y"
     {  (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 168:
 /* Line 1792 of yacc.c  */
-#line 1638 "awkgram.y"
+#line 1641 "awkgram.y"
     {
                (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
          }
@@ -3913,7 +3916,7 @@ regular_print:
 
   case 169:
 /* Line 1792 of yacc.c  */
-#line 1645 "awkgram.y"
+#line 1648 "awkgram.y"
     {
                INSTRUCTION *ip = (yyvsp[(1) - (1)])->lasti; 
                int count = ip->sub_count;      /* # of SUBSEP-seperated 
expressions */
@@ -3931,7 +3934,7 @@ regular_print:
 
   case 170:
 /* Line 1792 of yacc.c  */
-#line 1662 "awkgram.y"
+#line 1665 "awkgram.y"
     {
                INSTRUCTION *t = (yyvsp[(2) - (3)]);
                if ((yyvsp[(2) - (3)]) == NULL) {
@@ -3949,13 +3952,13 @@ regular_print:
 
   case 171:
 /* Line 1792 of yacc.c  */
-#line 1679 "awkgram.y"
+#line 1682 "awkgram.y"
     {  (yyval) = (yyvsp[(1) - (1)]); }
     break;
 
   case 172:
 /* Line 1792 of yacc.c  */
-#line 1681 "awkgram.y"
+#line 1684 "awkgram.y"
     {
                (yyval) = list_merge((yyvsp[(1) - (2)]), (yyvsp[(2) - (2)]));
          }
@@ -3963,13 +3966,13 @@ regular_print:
 
   case 173:
 /* Line 1792 of yacc.c  */
-#line 1688 "awkgram.y"
+#line 1691 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (2)]); }
     break;
 
   case 174:
 /* Line 1792 of yacc.c  */
-#line 1693 "awkgram.y"
+#line 1696 "awkgram.y"
     {
                char *var_name = (yyvsp[(1) - (1)])->lextok;
 
@@ -3981,7 +3984,7 @@ regular_print:
 
   case 175:
 /* Line 1792 of yacc.c  */
-#line 1701 "awkgram.y"
+#line 1704 "awkgram.y"
     {
                char *arr = (yyvsp[(1) - (2)])->lextok;
                (yyvsp[(1) - (2)])->memory = variable((yyvsp[(1) - 
(2)])->source_line, arr, Node_var_new);
@@ -3992,7 +3995,7 @@ regular_print:
 
   case 176:
 /* Line 1792 of yacc.c  */
-#line 1711 "awkgram.y"
+#line 1714 "awkgram.y"
     {
                INSTRUCTION *ip = (yyvsp[(1) - (1)])->nexti;
                if (ip->opcode == Op_push
@@ -4008,7 +4011,7 @@ regular_print:
 
   case 177:
 /* Line 1792 of yacc.c  */
-#line 1723 "awkgram.y"
+#line 1726 "awkgram.y"
     {
                (yyval) = list_append((yyvsp[(2) - (3)]), (yyvsp[(1) - (3)]));
                if ((yyvsp[(3) - (3)]) != NULL)
@@ -4018,7 +4021,7 @@ regular_print:
 
   case 178:
 /* Line 1792 of yacc.c  */
-#line 1732 "awkgram.y"
+#line 1735 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->opcode = Op_postincrement;
          }
@@ -4026,7 +4029,7 @@ regular_print:
 
   case 179:
 /* Line 1792 of yacc.c  */
-#line 1736 "awkgram.y"
+#line 1739 "awkgram.y"
     {
                (yyvsp[(1) - (1)])->opcode = Op_postdecrement;
          }
@@ -4034,43 +4037,43 @@ regular_print:
 
   case 180:
 /* Line 1792 of yacc.c  */
-#line 1739 "awkgram.y"
+#line 1742 "awkgram.y"
     { (yyval) = NULL; }
     break;
 
   case 182:
 /* Line 1792 of yacc.c  */
-#line 1747 "awkgram.y"
+#line 1750 "awkgram.y"
     { yyerrok; }
     break;
 
   case 183:
 /* Line 1792 of yacc.c  */
-#line 1751 "awkgram.y"
+#line 1754 "awkgram.y"
     { yyerrok; }
     break;
 
   case 186:
 /* Line 1792 of yacc.c  */
-#line 1760 "awkgram.y"
+#line 1763 "awkgram.y"
     { yyerrok; }
     break;
 
   case 187:
 /* Line 1792 of yacc.c  */
-#line 1764 "awkgram.y"
+#line 1767 "awkgram.y"
     { (yyval) = (yyvsp[(1) - (1)]); yyerrok; }
     break;
 
   case 188:
 /* Line 1792 of yacc.c  */
-#line 1768 "awkgram.y"
+#line 1771 "awkgram.y"
     { yyerrok; }
     break;
 
 
 /* Line 1792 of yacc.c  */
-#line 4086 "awkgram.c"
+#line 4089 "awkgram.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -4302,7 +4305,7 @@ yyreturn:
 
 
 /* Line 2055 of yacc.c  */
-#line 1770 "awkgram.y"
+#line 1773 "awkgram.y"
 
 
 struct token {
@@ -4395,6 +4398,9 @@ static struct token tokentab[] = {
 {"match",      Op_builtin,      LEX_BUILTIN,   NOT_OLD|A(2)|A(3), do_match },
 {"mktime",     Op_builtin,      LEX_BUILTIN,   GAWKX|A(1),     do_mktime },
 {"next",       Op_K_next,       LEX_NEXT,      0,              0 },
+#ifdef NUMDEBUG
+{"next_down",  Op_builtin,      LEX_BUILTIN,   GAWKX|A(1),     do_default },
+#endif
 {"nextfile",   Op_K_nextfile, LEX_NEXTFILE,    0,              0 },
 {"or",         Op_builtin,    LEX_BUILTIN,     GAWKX,          0 },
 {"patsplit",   Op_builtin,    LEX_BUILTIN,     GAWKX|A(2)|A(3)|A(4), 
do_patsplit },
@@ -7981,4 +7987,11 @@ one_line_close(int fd)
        return ret;
 }
 
-
+#ifdef NUMDEBUG
+static NODE *
+do_default(int nargs)
+{
+       fatal(_("not implemented"));
+       return NULL;
+}
+#endif
diff --git a/awkgram.y b/awkgram.y
index 6112414..65acd50 100644
--- a/awkgram.y
+++ b/awkgram.y
@@ -58,6 +58,9 @@ static int load_library(INSTRUCTION *file);
 static void next_sourcefile(void);
 static char *tokexpand(void);
 static bool is_deferred_variable(const char *name);
+#ifdef NUMDEBUG
+static NODE *do_default(int nargs);
+#endif
 
 #define instruction(t) bcalloc(t, 1, 0)
 
@@ -1859,6 +1862,9 @@ static struct token tokentab[] = {
 {"match",      Op_builtin,      LEX_BUILTIN,   NOT_OLD|A(2)|A(3), do_match },
 {"mktime",     Op_builtin,      LEX_BUILTIN,   GAWKX|A(1),     do_mktime },
 {"next",       Op_K_next,       LEX_NEXT,      0,              0 },
+#ifdef NUMDEBUG
+{"next_down",  Op_builtin,      LEX_BUILTIN,   GAWKX|A(1),     do_default },
+#endif
 {"nextfile",   Op_K_nextfile, LEX_NEXTFILE,    0,              0 },
 {"or",         Op_builtin,    LEX_BUILTIN,     GAWKX,          0 },
 {"patsplit",   Op_builtin,    LEX_BUILTIN,     GAWKX|A(2)|A(3)|A(4), 
do_patsplit },
@@ -5445,4 +5451,11 @@ one_line_close(int fd)
        return ret;
 }
 
-
+#ifdef NUMDEBUG
+static NODE *
+do_default(int nargs)
+{
+       fatal(_("not implemented"));
+       return NULL;
+}
+#endif
diff --git a/configure b/configure
index e3b43ce..2896259 100755
--- a/configure
+++ b/configure
@@ -5557,7 +5557,7 @@ else
 $as_echo "no" >&6; }
        if test -f $srcdir/.dev
        then
-               CFLAGS="$CFLAGS -DLDBLTEST=1"   # DO NOT TURN OFF ASSERTIONS
+               CFLAGS="$CFLAGS -DNUMDEBUG"     # DO NOT TURN OFF ASSERTIONS
        else
                CFLAGS="$CFLAGS -DNDEBUG"       # turn off assertions
        fi
diff --git a/configure.ac b/configure.ac
index 98e3c94..8d1e9b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -97,7 +97,7 @@ else
        AC_MSG_RESULT([no])
        if test -f $srcdir/.dev
        then
-               CFLAGS="$CFLAGS -DLDBLTEST=1"   # DO NOT TURN OFF ASSERTIONS
+               CFLAGS="$CFLAGS -DNUMDEBUG"     # DO NOT TURN OFF ASSERTIONS
        else
                CFLAGS="$CFLAGS -DNDEBUG"       # turn off assertions
        fi
diff --git a/format.c b/format.c
index ba95201..779faa9 100644
--- a/format.c
+++ b/format.c
@@ -723,7 +723,14 @@ out2:
 
                        s0 = s1;
                        break;
-
+#ifdef NUMDEBUG
+               case 'a':       /* hexadecimal */
+               case 'b':       /* MPFR binary format */
+                       if (numbr_hndlr ==  & awknum_hndlr || numbr_hndlr == & 
awkldbl_hndlr)
+                               ;       /* fall through -- make sure the stupid 
test will pass */
+                       else
+                               goto fmt1;
+#endif
                default:
                        if (isalpha(cs1)) {
                                if (do_lint)
diff --git a/long_double.c b/long_double.c
index c2a5c58..190efba 100644
--- a/long_double.c
+++ b/long_double.c
@@ -232,8 +232,11 @@ double_to_int(AWKLDBL x)
                x = -x;
        }
        if ((intval = gawk_floorl_finite_p(x, NULL)) < LDC(0.0)) {
-               /* outside range, use floor() for C double */
+#ifdef HAVE_FLOORL
+               intval = floorl(x);
+#else
                intval = (AWKLDBL) Floor((double) x);
+#endif
        }
        return intval * ((AWKLDBL) sign);
 }
@@ -282,10 +285,14 @@ awkldbl_init(bltin_t **bltins)
 numbr_handler_t *
 get_ldbl_handler(char *arg)
 {
-#if defined(LDBLTEST) && LDBLTEST == 1
+#ifdef NUMDEBUG
        extern numbr_handler_t float128_hndlr;
+       extern numbr_handler_t float80_hndlr;
        if (arg != NULL && arg[0] == '1')
                return & float128_hndlr;
+       if (arg != NULL && arg[0] == '0')
+               return & float80_hndlr;
 #endif
+
        return  & awkldbl_hndlr;
 }
diff --git a/long_double.h b/long_double.h
index 203e04b..2b8e22d 100644
--- a/long_double.h
+++ b/long_double.h
@@ -349,7 +349,7 @@ awkldbl_update_var(NODE *var)
 }
 
 /*
- * awkldbl_set_vars --- update internal variables for assignment
+ * awkldbl_set_var --- update internal variables for assignment
  *     to a special variable.
  */
 
@@ -358,16 +358,21 @@ awkldbl_set_var(const NODE *var)
 {
        NODE *val = var->var_value;
        AWKLDBL d;
-
-       d = LDBL_VAL(val);
+       
        if (var == NR_node) {
+               d = LDBL_VAL(val);
                MNR = d / LONG_MAX;
                NR = d - ((AWKLDBL) MNR) * LONG_MAX;
        } else if (var == FNR_node) {
+               d = LDBL_VAL(val);
                MFNR = d / LONG_MAX;
                FNR = d - ((AWKLDBL) MFNR) * LONG_MAX;
+       } else {
+               /* PREC and ROUNMODE */
+               if (do_lint)
+                       lintwarn(_("setting `%s' has no effect"),
+                               var == PREC_node ? "PREC" : "ROUNDMODE");
        }
-       /* N.B: PREC and ROUNMODE -- not relevant */
 }
 
 /* awkldbl_increment_var --- increment NR or FNR */
@@ -391,7 +396,11 @@ awkldbl_increment_var(const NODE *var, long nr)
 static void
 awkldbl_init_vars()
 {
-       /* dummy function */
+       unref(PREC_node->var_value);
+        PREC_node->var_value = make_awknum(LDBL_FRAC_BITS);
+       PREC_node->var_value->flags |= NUMINT;
+        unref(ROUNDMODE_node->var_value);
+        ROUNDMODE_node->var_value = make_string("N", 1);
 }
 
 /*
@@ -1561,6 +1570,10 @@ out_of_range:
        case 'e':
        case 'f':
        case 'E':
+#ifdef NUMDEBUG
+       case 'a':       /* hexadecimal */
+       case 'b':       /* MPFR binary format */
+#endif
 fmt1:
                if (! spec->have_prec)
                        spec->prec = DEFAULT_G_PRECISION;
diff --git a/misc/ChangeLog b/misc/ChangeLog
new file mode 100644
index 0000000..4dd9c3f
--- /dev/null
+++ b/misc/ChangeLog
@@ -0,0 +1,11 @@
+2013-02-02         John Haque            <address@hidden>
+
+       * float80.c: New file. Provides 80-bit long-double support
+       without any math routines etc. for tests.
+       * floatcmp.awk: New file. Alternative to cmp for floating-point numbers.
+       * gawk_math.c (gawk_sqrtl, gawk_logl, gawk_expl, gawk_powl):
+       Replacement long double math functions.
+       * ldbl-tests/*.awk: Tests for the math functions.
+       * ldblin.awk: Generate input for the tests.
+       * splitlog2.awk: Split log2 into high and low parts.
+       * splitpi4.awk: Split pi/4 into 3 parts.
diff --git a/misc/Makefile b/misc/Makefile
index 8aef648..bafec60 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -12,7 +12,7 @@ ALL_CFLAGS = $(CFLAGS) -fPIC -DGAWK -DHAVE_CONFIG_H -c -I.. 
-I.
 
 all: $(LIBSTATIC)
 
-OBJS := float128.o
+OBJS := float128.o float80.o
 
 $(LIBSTATIC): $(OBJS)
        $(AR) rc $(LIBSTATIC) $(OBJS)
@@ -20,6 +20,8 @@ $(LIBSTATIC): $(OBJS)
 
 float128.o: float128.c ../awk.h ../long_double.h ./gawk_math.h ./gawk_math.c
 
+float80.o: float80.c ../awk.h ../long_double.h ./gawk_math.h ./gawk_math.c
+
 .c.o:
        $(CC) $(ALL_CFLAGS) $< -o $@
 
@@ -32,7 +34,17 @@ check:
 
 LDBL_TESTS = \
        ldblint64 \
-       ldblint128
+       ldblint128 \
+       sqrt64 \
+       sqrt113 \
+       log64 \
+       log113 \
+       exp64 \
+       exp113 \
+       pow64 \
+       pow113
+
+INFILE = ldbl-tests/data.in
 
 # An attempt to print something that can be grepped for in build logs
 pass-fail:
@@ -45,12 +57,64 @@ pass-fail:
 ldbl-tests: $(LDBL_TESTS)
        @$(MAKE) pass-fail TESTDIR=ldbl-tests
 
+
+$(INFILE):
+       @$(AWK) -M -vPREC=quad -f ldblin.awk > $(INFILE) 2>&1
+
 ldblint64:
        @echo $@
-       @$(AWK) -B -f ldbl-tests/address@hidden > ldbl-tests/_$@ 2>&1
+       @$(AWK) -B0 -f ldbl-tests/address@hidden > ldbl-tests/_$@ 2>&1
        @-$(CMP) ldbl-tests/address@hidden ldbl-tests/_$@ && rm -f 
ldbl-tests/_$@
 
 ldblint128:
        @echo $@
        @$(AWK) -B1 -f ldbl-tests/address@hidden > ldbl-tests/_$@ 2>&1
        @-$(CMP) ldbl-tests/address@hidden ldbl-tests/_$@ && rm -f 
ldbl-tests/_$@
+
+sqrt64: $(INFILE)
+       @echo $@
+       @$(AWK) -B0 -vDIG=17 -f ldbl-tests/sqrt.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=17 -vPREC=64 -f ldbl-tests/sqrt.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+sqrt113: $(INFILE)
+       @echo $@
+       @$(AWK) -B1 -vDIG=32 -f ldbl-tests/sqrt.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=32 -vPREC=113 -f ldbl-tests/sqrt.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+log64: $(INFILE)
+       @echo $@
+       @$(AWK) -B0 -vDIG=17 -f ldbl-tests/log.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=17 -vPREC=64 -f ldbl-tests/log.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+log113: $(INFILE)
+       @echo $@
+       @$(AWK) -B1 -vDIG=32 -f ldbl-tests/log.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=32 -vPREC=113 -f ldbl-tests/log.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+exp64: $(INFILE)
+       @echo $@
+       @$(AWK) -B0 -vDIG=17 -f ldbl-tests/exp.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=17 -vPREC=64 -f ldbl-tests/exp.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+exp113: $(INFILE)
+       @echo $@
+       @$(AWK) -B1 -vDIG=32 -f ldbl-tests/exp.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=32 -vPREC=113 -f ldbl-tests/exp.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -f floatcmp.awk ldbl-tests/_$@ ldbl-tests/address@hidden && 
rm ldbl-tests/_$@
+
+pow64: $(INFILE)
+       @echo $@
+       @$(AWK) -B0 -vDIG=17 -f ldbl-tests/pow.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=17 -vPREC=64 -f ldbl-tests/pow.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -vTOL=10 -f floatcmp.awk ldbl-tests/_$@ 
ldbl-tests/address@hidden && rm ldbl-tests/_$@
+
+pow113: $(INFILE)
+       @echo $@
+       @$(AWK) -B1 -vDIG=32 -f ldbl-tests/pow.awk > ldbl-tests/_$@ $(INFILE) 
2>&1
+       @$(AWK) -M -vDIG=32 -vPREC=113 -f ldbl-tests/pow.awk > 
ldbl-tests/address@hidden $(INFILE) 2>&1
+       @-$(AWK) -M -vTOL=10 -f floatcmp.awk ldbl-tests/_$@ 
ldbl-tests/address@hidden && rm ldbl-tests/_$@
diff --git a/misc/float128.c b/misc/float128.c
index 3f6ae12..ac66520 100644
--- a/misc/float128.c
+++ b/misc/float128.c
@@ -25,7 +25,7 @@
 
 #include "awk.h"
 
-#if defined(LDBLTEST) && LDBLTEST == 1
+#ifdef NUMDEBUG
 #include <math.h>
 #include "random.h"
 #if 0
@@ -135,6 +135,15 @@ static inline int isinf_awkldbl(AWKLDBL x) { return 
isnan(x - x); }
 #endif
 #define isinf isinf_awkldbl
 
+/*
+ * The relative error need to be less than 5 X 10^-k for rounding to
+ * k significant digits. Note tht FLT128_DIG is 33. If we add 2 extra
+ * digits for rounding error, the allowable maximum relative error
+ * is 5.0e-35.
+ */
+
+#define        REL_ERROR       LDC(5.0e-35)
+
 numbr_handler_t float128_hndlr;
 
 #define awkldbl_hndlr float128_hndlr
@@ -415,11 +424,28 @@ double_to_int(AWKLDBL x)
                sign = -1;
                x = -x;
        }
+
        if ((intval = gawk_floorl_finite_p(x, NULL)) < LDC(0.0)) {
-               /* outside range */
-               /* FIXME -- use format_float_1 with "%.0Lf" (MPFR) */
+#if 0
                intval = (AWKLDBL) floorl((long double) x);
+#endif
+               const char *str1;
+               char str2[64];
+               mpfr_t ap_floatval, ap_intval;
+
+               str1 = float128_to_hex(x);
+               mpfr_init2(ap_floatval, 113);
+               mpfr_init2(ap_intval, 113);
+               mpfr_set_str(ap_floatval, str1, 16, MPFR_RNDN);
+               mpfr_trunc(ap_intval, ap_floatval);
+
+               /* get back a hexadecimal string representation */
+               (void) mpfr_snprintf(str2, 64, "%RNa", ap_intval);
+               mpfr_clear(ap_floatval);
+               mpfr_clear(ap_intval);
+               intval = hex_to_float128(str2);
        }
+
        return intval * ((AWKLDBL) sign);
 }
 
@@ -444,4 +470,4 @@ strtofloat128(const char *str, char **endptr)
        return hex_to_float128(hexstr); 
 }
 
-#endif /* LDBLTEST == 1 */
+#endif /* NUMDEBUG */
diff --git a/misc/float80.c b/misc/float80.c
new file mode 100644
index 0000000..8d2a808
--- /dev/null
+++ b/misc/float80.c
@@ -0,0 +1,138 @@
+/*
+ * float80.c - 80-bit float without any math routine.
+ */
+
+/* 
+ * Copyright (C) 2012 the Free Software Foundation, Inc.
+ * 
+ * This file is part of GAWK, the GNU implementation of the
+ * AWK Programming Language.
+ * 
+ * GAWK is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ * 
+ * GAWK is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
+ */
+#include "awk.h"
+
+#ifdef NUMDEBUG
+
+#include <math.h>
+#include "random.h"
+#include "floatmagic.h"        /* definition of isnan */
+
+#include "format.h"
+
+#define AWKLDBL        long double
+#define LDBL_VAL(n)    (*((AWKLDBL *) (n)->qnumbr))
+#define LDC(x)         x##L
+
+#ifndef FLT_RADIX
+#define FLT_RADIX 2
+#endif
+
+#define LDBL_FRAC_BITS LDBL_MANT_DIG
+#define        LDBL_INT_BITS   64
+
+#define get_long_double(d)     emalloc(d, void *, sizeof(AWKLDBL), "float80")
+#define free_long_double(d)    efree(d)
+
+/* we want to format integers ourself */
+#define GAWK_FMT_INT 1
+
+#define gawk_int_t long
+#define gawk_uint_t unsigned long
+#ifdef SIZEOF_GAWK_INT
+#undef SIZEOF_GAWK_INT
+#undef GAWK_INT_MAX
+#undef GAWK_INT_MIN
+#undef GAWK_UINT_MAX
+#endif
+
+#define SIZEOF_GAWK_INT        4
+#define        GAWK_INT_MAX    LONG_MAX
+#define        GAWK_INT_MIN    LONG_MIN
+#define        GAWK_UINT_MAX   ULONG_MAX
+
+static int format_uint_finite_p(char *str, size_t size, AWKLDBL x);
+static AWKLDBL gawk_floorl_finite_p(AWKLDBL x, gawk_uint_t *chunk);
+static int format_float_1(char *str, size_t size, const char *format, int fw, 
int prec, AWKLDBL x);
+static int format_uint_1(char *str, size_t size, AWKLDBL x);
+static AWKLDBL double_to_int(AWKLDBL x);
+
+#define gawk_strtold strtold
+
+#define GAWK_INFINITY  HUGE_VALL
+#define GAWK_NAN       (LDC(0.0) / LDC(0.0))
+
+/*
+ * The relative error need to be less than 5 X 10^-k for rounding to
+ * k significant digits.
+ */
+
+#define        REL_ERROR       LDC(5.0e-20)
+
+numbr_handler_t float80_hndlr;
+
+#define awkldbl_hndlr float80_hndlr
+
+#include "misc/gawk_math.h"
+#include "long_double.h"
+#include "misc/gawk_math.c"
+
+/*
+ * format_float_1 --- format a single AWKLDBL value according to FORMAT.
+ *     The value must be finite.       
+ */
+
+static int
+format_float_1(char *str, size_t size, const char *format, int fw, int prec, 
AWKLDBL x)
+{
+       return snprintf(str, size, format, fw, prec, x);
+}
+
+/*
+ * format_uint_1 --- format a long double as an unsigned integer. The double 
value
+ *     must be finite and >= 0.
+ */
+
+static int
+format_uint_1(char *str, size_t size, AWKLDBL x)
+{
+       int ret;
+       if ((ret = format_uint_finite_p(str, size, x)) < 0)
+               return snprintf(str, size, "%.0Lf", x);
+       return ret;
+}
+
+/* double_to_int --- convert double to int, used in several places */
+
+static AWKLDBL
+double_to_int(AWKLDBL x)
+{
+       AWKLDBL intval;
+       int sign = 1;
+
+       if (isnan(x) || isinf(x) || x == LDC(0.0))
+               return x;
+       if (x < LDC(0.0)) {
+               sign = -1;
+               x = -x;
+       }
+       if ((intval = gawk_floorl_finite_p(x, NULL)) < LDC(0.0)) {
+               /* outside range, use floorl() */
+               intval = (AWKLDBL) floorl((long double) x);
+       }
+       return intval * ((AWKLDBL) sign);
+}
+
+#endif /* NUMDEBUG */
diff --git a/misc/floatcmp.awk b/misc/floatcmp.awk
new file mode 100644
index 0000000..87c8ea2
--- /dev/null
+++ b/misc/floatcmp.awk
@@ -0,0 +1,57 @@
+# floatcmp.awk --- check floating-point numbers for differences in
+#       sig digs.
+
+BEGIN {
+       if (ARGC < 3) {
+               printf("Usage: gawk -M [-vTOL=1] -f floatcmp.awk file1 file2\n")
+               exit(1)
+       }
+
+       PREC = 200
+
+       # TOL -- allowable difference in significant digits 
+       if (! TOL)
+               TOL = 1
+
+       file1 = ARGV[1]
+       file2 = ARGV[2]
+       line = 0
+       while (1) {
+               ret1 = (getline v1 < file1) 
+               ret2 = (getline v2 < file2) 
+
+               if (ret1 > 0 && ret2 > 0) {
+                       line++
+                       if ((v1 "") == (v2 ""))
+                               continue;
+                       e1 = index(v1, "e")
+                       e2 = index(v2, "e")
+                       if (e1 > 0 && e2 > 0 &&         # exclude nans and 
infinities
+                                       substr(v1, e1) == substr(v2, e2)) { # 
same exponents
+                               sub(/e.*$/, "", v1)
+                               sub(/e.*$/, "", v2)
+                               sub(/\./, "", v1)
+                               sub(/\./, "", v2)
+
+                               # the following test requires arbitrary 
precision math.
+                               # PREC must be large enough to represent 
33-digit (or more)
+                               # integers precisely.
+                               diff = v2 - v1
+                               if (diff <= TOL && diff >= -TOL) 
+                                       continue
+                       }
+
+                       printf("%s %s differ: byte ?, line %d\n", file1, file2, 
line)
+                       exit(1)
+               }
+
+               if (ret1 == 0 && ret2 == 0)
+                       exit(0)
+               if (ret1 < 0 || ret2 < 0) {
+                       printf("cmp: %s: %s\n", ret1 < 0 ? file1 : file2, ERRNO)
+                       exit(1)
+               }
+               printf("EOF on %s\n", ret1 == 0 ? file1 : file2)
+               exit(1)
+       }
+}
diff --git a/misc/gawk_math.c b/misc/gawk_math.c
index 3e8e6ef..6981725 100644
--- a/misc/gawk_math.c
+++ b/misc/gawk_math.c
@@ -23,6 +23,26 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 
USA
  */
 
+
+#define _0L    LDC(0.0)
+#define _1L    LDC(1.0)
+#define _2L    LDC(2.0)
+
+/*
+ * Constants for computation using long doubles with enough digits for the 
128-bit quad.
+ */
+
+#define GAWK_LOG2      LDC(0.693147180559945309417232121458176568)  /* log 2 
(base e) */
+#define        GAWK_LOG2_HIGH  LDC(0.6931471801362931728363037109375)       /* 
high 32 bits (exact representation) */
+#define GAWK_LOG2_LOW  LDC(4.236521365809284105206765680755001344e-10) /* 
variable precision low bits */
+
+#define GAWK_SQRT2     LDC(1.414213562373095048801688724209698079)     /* 
sqrt(2) */
+#define GAWK_SQRT1_2   LDC(0.707106781186547524400844362104849039)     /* 
1/sqrt(2) */
+
+
+static AWKLDBL taylor_exp(AWKLDBL x);
+static AWKLDBL gawk_frexpl(AWKLDBL x, int *exponent);
+
 static AWKLDBL
 gawk_sinl(AWKLDBL x)
 {
@@ -41,16 +61,133 @@ gawk_atan2l(AWKLDBL y, AWKLDBL x)
        return atan2( (double) y, (double) x);
 }
 
+/* gawk_logl --- Compute log(x) */
+
 static AWKLDBL
 gawk_logl(AWKLDBL x)
 {
-       return log( (double) x);
+       AWKLDBL frac, exponent;
+       AWKLDBL y, ypow2, ypow_odd, sum, term, err;
+       int iexp, sign, i;
+       
+       /*
+        *      ln(x) = 2 * arctanh(y)
+        *            = 2 * (y + y^3 / 3 + y^5 / 5 + ..) where y = (x - 1) / (x 
+ 1) 
+        */
+
+       if (isnan(x) || (isinf(x) && x > _0L))
+               return x;
+       if (x < _0L)            /* XXX: not setting errno = EDOM */
+               return GAWK_NAN;
+       if (x == _0L)           /* XXX: not setting errno = ERANGE */
+               return -GAWK_INFINITY;
+       
+       if (x == _1L)   /* special case */
+               return _0L;
+       if (x == _2L)   /* special case */
+               return GAWK_LOG2;
+
+       frac = gawk_frexpl(x, & iexp);  /* frac in [1, 2) */
+       exponent = (AWKLDBL) iexp;
+
+
+       /*
+        * arctanh(x) series has faster convergence when x is close to 1.
+        * Perform a range reduction so that 1 / sqrt(2) <= x <= sqrt(2).
+        */
+
+       if (frac > GAWK_SQRT2 || frac < GAWK_SQRT1_2) {
+               /*
+                * Instead of frac = frac / sqrt(2), compute y directly:
+                *      y = (f /sqrt(2) - 1) / (f / sqrt(2) + 1)
+                *        = (f - sqrt(2)) / (f + sqrt(2))
+                */
+
+               y = (frac - GAWK_SQRT2) / (frac + GAWK_SQRT2);
+               exponent += LDC(0.5);
+       } else
+               y = (frac - _1L) / (frac + _1L);
+
+       if (y == _0L)   /* tricky special case */
+               return exponent * GAWK_LOG2;
+
+       sign = 1;
+       if (y < _0L) {
+               sign = -1;
+               y = -y;
+       }
+
+       i = 1;
+       ypow2 = y * y;
+       ypow_odd = y;
+       sum = y;
+       do {
+               ypow_odd *= ypow2;
+               i += 2;
+               term = ypow_odd / ((AWKLDBL) i);
+               sum += term;
+               err = term / sum;
+       } while (err > REL_ERROR);
+       sum = LDC(2.0) * sum + exponent * GAWK_LOG2;
+
+       return (sign > 0 ? sum : -sum);
 }
 
+/* gawk_expl --- Compute exp(x) */
+
 static AWKLDBL
 gawk_expl(AWKLDBL x)
 {
-       return exp( (double) x);
+       AWKLDBL expval, k = _0L;
+       int sign;
+
+       if (isnan(x) || (isinf(x) && x > _0L))
+               return x;
+       if (isinf(x))   /* -inf */
+               return _0L;
+       if (x == _0L)
+               return _1L;
+       if (x >= (AWKLDBL) LDBL_MAX_EXP * GAWK_LOG2)    /* overflow */
+               return GAWK_INFINITY;
+       if (x <= (AWKLDBL) (LDBL_MIN_EXP - LDBL_MANT_DIG - 1) * GAWK_LOG2)      
/* underflow */
+               return _0L;
+
+       sign = 1;
+       if (x < _0L) {
+               sign = -1;
+               x = -x;
+       }
+
+       /* XXX: Outside overflow and underflow range k has at most 14 bits. */
+       if (x >= GAWK_LOG2)
+               k = double_to_int(x / GAWK_LOG2);  
+
+       if (k == _0L)
+               expval = taylor_exp(x);
+       else {
+               /* range reduction -- 0 < x < log(2) (0.693...) */
+
+               AWKLDBL y;
+
+               /* High precision calculation using limited precision float */
+               /*
+                * We need to calculate x - k * log2 with extra precision. If k 
is not a power
+                * of 2, it would require more than LDBL_MANT_DIG bits for the 
product
+                * to be precise to LDBL_MANT_DIG bits.
+                */
+
+               y = x - k * GAWK_LOG2_HIGH;
+               y -= k * GAWK_LOG2_LOW;
+
+#if 0
+               if (y > GAWK_LOG2 || y < _0L)   /* kludge */
+                       return sign > 0 ? GAWK_INFINITY : _0L;
+#endif
+               expval = taylor_exp(y);
+               expval *= pow2ld((unsigned int) k);
+       }
+
+       return sign < 0 ? (_1L / expval) : expval;
 }
 
 static AWKLDBL
@@ -59,14 +196,289 @@ gawk_fmodl(AWKLDBL x, AWKLDBL y)
        return fmod( (double) x, (double) y);
 }
 
+
+#define        GAWK_LDBL_INTEGER       1
+#define        GAWK_LDBL_EVEN_INTEGER  2
+#define        GAWK_LDBL_ODD_INTEGER   4
+
+/* gawk_is_integer__p --- is x an (even or odd) integer ? */
+
+static unsigned int
+gawk_is_integer__p(AWKLDBL x)
+{
+       AWKLDBL ival;
+       unsigned ret = 0;
+
+       if (isnan(x) || isinf(x))
+               return (unsigned int) false;
+       if (x < _0L)
+               x = -x;
+       if (x < _1L)
+               return (unsigned int) false;
+       if ((ival = double_to_int(x)) != x)
+               return (unsigned int) false;
+       ret = GAWK_LDBL_INTEGER;
+       if (ival >= pow2ld(LDBL_MANT_DIG))
+               ret |= GAWK_LDBL_EVEN_INTEGER;
+       else {
+               ival /= _2L;
+               if (ival == double_to_int(ival))
+                       ret |= GAWK_LDBL_EVEN_INTEGER;
+               else
+                       ret |= GAWK_LDBL_ODD_INTEGER;
+       }
+       return ret;
+}
+
+#define gawk_is_integer(x)     ((gawk_is_integer__p(x) & GAWK_LDBL_INTEGER) != 
0)
+#define gawk_is_odd_integer(x) ((gawk_is_integer__p(x) & 
GAWK_LDBL_ODD_INTEGER) != 0)
+
+/* gawk_powl --- Compute x^y */
+
 static AWKLDBL
 gawk_powl(AWKLDBL x, AWKLDBL y)
 {
-       return pow( (double) x, (double) y);
+       AWKLDBL expval;
+       int sign;
+
+       if ((! isnan(x) && x == _1L) || (! isnan(y) && y == _0L))
+               return _1L;
+       if (isnan(x) || isnan(y))
+               return GAWK_NAN;
+
+       /* Neither x or y is NaN and y isn't 0 */
+       if (isinf(x)) {
+               if (x > _0L)
+                       return y < _0L ? _0L : GAWK_INFINITY;
+
+               /* x == -inf */
+               if (y < _0L)
+                       return (! isinf(y) && gawk_is_odd_integer(y)) ? -_0L : 
_0L;
+               if (y > _0L)
+                       return (! isinf(y) && gawk_is_odd_integer(y)) ? 
-GAWK_INFINITY : GAWK_INFINITY;
+
+       } else {
+               /* x isn't infinity */
+               if (x < _0L && ! isinf(y) && ! gawk_is_integer(y)) 
+                       return GAWK_NAN;
+
+               if (isinf(y)) {
+                       if (x == -_1L)
+                               return _1L;
+                       /* x == +1 handled above */
+                       if (x > -_1L && x < _1L)
+                               return (y == -GAWK_INFINITY) ? GAWK_INFINITY : 
_0L;
+                       /* abs(x) > 1 */
+                       return (y < _0L) ? _0L : GAWK_INFINITY;
+               }
+
+               /* y isn't infinity */
+               if (x == _0L && y > _0L)
+                       return gawk_is_odd_integer(y) ? x : _0L;
+
+               if (x == _0L && y < _0L) {
+                       if (gawk_is_odd_integer(y))     /* HUGE_VALL with same 
sign as x */
+                               return (AWKLDBL) pow((double) x, (double) y);
+                       /* + HUGE_VALL */
+                       return GAWK_INFINITY;
+               }
+       }
+
+       sign = 1;
+       if (y < _0L) {
+               sign = -1;
+               y = -y;
+       }
+
+       if (x < _0L) {
+               AWKLDBL result, d;
+
+               /* y is integer and != 0 */
+
+               result = x;
+               for (d = _1L; d < y; d += _1L)
+                       result *= x;
+               return sign > 0 ? result : _1L / result;
+       }
+
+       /* x^y =  exp(y * log(x)), x > 0 */
+
+       if (y <= (AWKLDBL) GAWK_UINT_MAX) {
+               AWKLDBL frac;
+               gawk_uint_t intpart;
+
+               /*
+                * divide y into integral and fractional parts, use "repeated 
squaring"
+                * to compute x^integer and exp(fraction * log(x)) for the 
fractional power.
+                */
+
+               intpart = (gawk_uint_t) double_to_int(y);
+               frac = y - (AWKLDBL) intpart;
+               expval = _1L;
+               if (intpart > 0) {
+                       AWKLDBL z = x;
+                       while (intpart > 1) {
+                               if ((intpart % 2) == 1)
+                                       expval *= z;
+                               z *= z;
+                               intpart /= 2;
+                       }
+                       expval *= z;
+               }
+               expval *= gawk_expl(frac * gawk_logl(x));
+       } else
+               expval = gawk_expl(y * gawk_logl(x));   /* XXX: likely infinity 
or zero */ 
+
+       return sign > 0 ? expval : (_1L / expval);
 }
 
+/* gawk_sqrtl --- Compute sqrt(x) using Newton's method */
+
 static AWKLDBL
 gawk_sqrtl(AWKLDBL x)
 {
-       return sqrt( (double) x);
+       AWKLDBL yn;
+
+       if (isnan(x) || (isinf(x) && x > _0L))  /* NaN or +inf */
+               return x;
+       if (isinf(x) || x < _0L)        /* -inf or negative */
+               return GAWK_NAN;        /* XXX: not setting errno = EDOM */
+       if (x == _0L)
+               return x;       /* return +0 or -0 */
+
+       if (x <= DBL_MAX && x >= DBL_MIN) {
+               /* use double-precision sqrt value as the initial guess. */
+
+               yn = sqrt( (double) x);
+       } else {
+               /*
+                * outside of the range of C double, we have to compute
+                * the initial guess differently.
+                */
+
+               AWKLDBL frac;
+               int iexp;
+
+               frac = gawk_frexpl(x, & iexp);  /* frac is in [1, 2) */
+               if ((iexp % 2) != 0) {
+                       /* force the exponent to be an even integer */ 
+                       frac /= _2L;
+                       iexp++;
+               }
+               yn = sqrt( (double) frac);
+               iexp /= 2;
+               if (iexp >= 0)
+                       yn *= pow2ld(iexp);
+               else
+                       yn /= pow2ld(-iexp);
+       }
+
+       /* XXX: Exactly 3 iterations. 2 maybe enough ? */
+       yn = (yn + x / yn) / _2L;
+       yn = (yn + x / yn) / _2L;
+       yn = (yn + x / yn) / _2L;
+
+       return yn;
+}
+
+
+/*
+ * gawk_frexpl --- split the number x into a normalized fraction and an 
exponent.
+ *     The fraction is in the range [1, 2) (and NOT [0.5, 1)).
+ */
+
+static AWKLDBL
+gawk_frexpl(AWKLDBL x, int *exponent)
+{
+       AWKLDBL y;
+       unsigned low, high, mid;
+
+       /* (isnormal(x) && x > 0) is assumed to be true */
+
+       assert(exponent != NULL);
+       *exponent = 0;
+
+       low = 0;
+       if (x > _2L) {
+               high = LDBL_MAX_EXP - 1;        /* XXX: should be 4 * 
LDBL_MAX_EXP - 1 if FLT_RADIX = 16 ? */
+               while (low <= high) {
+                       mid = (low + high) / 2;
+                       y = x / pow2ld(mid);
+                       if (y > _2L)
+                               low = mid + 1;
+                       else
+                               high = mid - 1;
+               }
+               x /= pow2ld(low);
+               *exponent = low;
+       } else if (x < _1L) {
+               high = LDBL_MAX_EXP - 1;        /* could be -LDBL_MIN_EXP, but 
no harm in using LDBL_MAX_EXP */
+               while (low <= high) {
+                       mid = (low + high) / 2;
+                       y =  x * pow2ld(mid);
+                       if (y < _1L)
+                               low = mid + 1;
+                       else
+                               high = mid - 1;
+               }
+               x *= pow2ld(low);
+               *exponent = -low;
+       }
+       if (x == _2L) {
+               x = _1L;
+               ++*exponent;
+       }
+       return x;
+}
+
+/* taylor_exp --- Compute exp(x) using Taylor series and modified squaring 
reduction */
+
+static AWKLDBL
+taylor_exp(AWKLDBL x)
+{
+       AWKLDBL xpow, expval;
+       AWKLDBL err, term, y, fact;
+       unsigned int i;
+       int k;
+
+       /*
+        * Method: Taylor series and squaring for large x.
+        *      exp(x) = 1 + x + x ^ 2 / 2! + x ^ 3 / 3! + ..., x < 1 
+        *
+        *      A modification of the squaring reduction allows to 
significantly reduce the
+        *      round-off error [*]. Instead of exp(x) = exp(x/2)^2, we use the 
identity
+        *              exp(x) - 1 = (exp(x/2) - 1)*(exp(x/2) + 1)
+        *      and reduce exp(x) - 1 directly to exp(x/2) - 1. If y = exp(x/2) 
- 1, then
+        *              exp(x) - 1 = 2*y + y^2.
+        *
+        *      [*] R. P. Brent, A Fortran Multiple-Precision Arithmetic 
Package,
+        *      ACM Transactions on Mathematical Software 4, no. 1 (1978), p. 
57. 
+        */
+
+       if (x == _0L)
+               return _1L;
+
+       k = 1;
+       while (x > 0.001) {
+               /* XXX: For x <= 0.001, max(k) = 10, and max # of terms 6 
(80-bit) / 10 (128-bit) */
+               
+               x /= _2L; 
+               k++;
+       }
+
+       y = xpow = x;
+       fact = _1L;
+       i = 1;
+       do {
+               fact *= (AWKLDBL) ++i;
+               xpow *= x;
+               term = xpow / fact;
+               y += term;
+               err = term / y;
+       } while (err > REL_ERROR);
+
+       /* squaring reduction */
+       while (--k > 0)
+               y = 2 * y + y * y;
+       return y + _1L;
 }
diff --git a/misc/ldbl-tests/exp.awk b/misc/ldbl-tests/exp.awk
new file mode 100644
index 0000000..f74a1e8
--- /dev/null
+++ b/misc/ldbl-tests/exp.awk
@@ -0,0 +1,14 @@
+{
+       y = exp($1);
+
+       # don't have -M IEEE emulation for 64-bit binary
+       # need to replace huge values with infinities.
+       # "quad" and 64-bit long double has same exponent range.
+       # This does not effect the binary formats B0, B1
+
+       save_PREC = PREC
+       PREC = "quad"
+       y += 0
+       printf("%*.*e\n", 0, DIG, y)
+       PREC = save_PREC
+}
diff --git a/misc/ldbl-tests/log.awk b/misc/ldbl-tests/log.awk
new file mode 100644
index 0000000..6035be1
--- /dev/null
+++ b/misc/ldbl-tests/log.awk
@@ -0,0 +1,3 @@
+{
+       printf("%*.*e\n", 0, DIG, log($1))
+}
diff --git a/misc/ldbl-tests/pow.awk b/misc/ldbl-tests/pow.awk
new file mode 100644
index 0000000..0e75b56
--- /dev/null
+++ b/misc/ldbl-tests/pow.awk
@@ -0,0 +1,29 @@
+BEGIN {
+       x1 = 0.1
+       x2 = 131.4321211
+       x3 = 1.1234567e100
+}
+{
+       y1 = x1^$1
+       y2 = x2^$1
+       y3 = x3^$1
+       # don't have -M IEEE emulation for 64-bit binary
+       # need to replace huge values with infinities.
+       # "quad" and 64-bit long double has same exponent range.
+       # This does not effect the binary formats B0, B1
+
+       save_PREC = PREC
+       PREC = "quad"
+       y1 += 0; y2 += 0; y3 += 0
+
+       if (y1 <= 1.0e750) {
+               printf("%*.*e\n", 0, DIG, y1)
+       }
+       if (y2 <= 1.0e750) {
+               printf("%*.*e\n", 0, DIG, y2)
+       }
+       if (y3 <= 1.0e750) {
+               printf("%*.*e\n", 0, DIG, y3)
+       }
+       PREC = save_PREC
+}
diff --git a/misc/ldbl-tests/sqrt.awk b/misc/ldbl-tests/sqrt.awk
new file mode 100644
index 0000000..68cd48b
--- /dev/null
+++ b/misc/ldbl-tests/sqrt.awk
@@ -0,0 +1,3 @@
+{
+       printf("%*.*e\n", 0, DIG, sqrt($1))
+}
diff --git a/misc/ldblin.awk b/misc/ldblin.awk
new file mode 100644
index 0000000..be6b832
--- /dev/null
+++ b/misc/ldblin.awk
@@ -0,0 +1,26 @@
+# generate input data for tests
+# gawk -M -vPREC=quad -f .. 
+
+BEGIN {
+       # 16000 almost LDBL_MAX_EXP or -LDBL_MIN_EXP
+
+       for (i = -16000; i < -1000; i += 255.5)
+               printf("%0.17e\n", 1.0*2^i)
+       for (i = -1000; i < -100; i += 25.5)
+               printf("%0.17e\n", 1.0*2^i)
+       for (i = -100; i < -10; i += 2.5)
+               printf("%0.17e\n", 1.0*2^i)
+       for (i = -10; i < -1; i += 0.75)
+               printf("%0.17e\n", 1.0*2^i)
+       for (i = -1; i < 2.0; i += 0.1)
+               printf("%0.17e\n", 2^i)
+       for (i = 1; i < 10; i += 0.75)
+               printf("%0.17e\n", 1.0 * 2^i)
+       for (i = 10; i < 100; i += 2.5)
+               printf("%0.17e\n", 1.0 * 2^i)
+       for (i = 100; i < 1000; i += 25.5)
+               printf("%0.17e\n", 1.0 * 2^i)
+       for (i = 1000; i < 16000; i += 255.5)
+               printf("%0.17e\n", 1.0 * 2^i)
+}
+
diff --git a/misc/splitlog2.awk b/misc/splitlog2.awk
new file mode 100644
index 0000000..16db883
--- /dev/null
+++ b/misc/splitlog2.awk
@@ -0,0 +1,49 @@
+# Split log2 into two parts -- a high part which is exactly representable
+#      with less than the float-precision and a variable precision low part.
+#              log2 = log2_high + log2_low
+#
+#      Extra precision calculation with limited precision float:
+#              r = x - q * log2,       q is an integer
+#                = (x - q * log2_high) - q * log2_low
+#      if the high part has M bits, the integer q should have less than
+#      (float_prec - M) non-zero leading bits.
+
+# Usage: $ gawk -M -f splitlog2.awk
+
+BEGIN {
+       PREC = 300      # at least 64 + 113 (+ few more) 
+
+       y = log(2)
+       printf("log2       = %0.36f\n", y)
+
+       PREC = 32
+       log2_high = next_down(y)        # exactly representable with 32 bits
+
+       PREC = 300
+       log2_low = (y - log2_high)
+
+       printf("log2_high  = %0.36f\n", log2_high)
+       printf("log2_low   = %0.36e\n", log2_low)
+
+       # test case with 128-bit long double
+       print "--- test calculation: r = x - q * log2 ---"
+       PREC = 113
+       ROUND_MODE = "N"
+
+       log2_high += 0  # float precision 
+       log2_low += 0   # Ditto
+
+       x = "501.0"
+       x += 0
+       q = int(x / log(2.0))
+
+       # calculate with float precision
+       printf("regular math   : %0.32e\n", x - q * log(2)) 
+
+       # calculate with more precision
+       printf("high-prec math : %0.32e\n", (x - q * log2_high) - q * log2_low)
+
+       # extra precision with ap float
+       PREC = 300
+       printf("ap math        : %0.32e\n", x - q * log(2))
+}
diff --git a/misc/splitpi4.awk b/misc/splitpi4.awk
new file mode 100644
index 0000000..75b001a
--- /dev/null
+++ b/misc/splitpi4.awk
@@ -0,0 +1,116 @@
+# Split pi/4 into two parts
+#      pi_4 = pi_4_high (exact 32-bit)+ pi_4_med (exact 32-bit) +  pi_4_low
+#
+
+# $ gawk -M -f splitpi4.awk
+
+BEGIN {
+       PREC = 500 
+
+       y = atan2(1, 0) / 2;    # N.B.: integer constants not floats e.g 1.0
+
+       PREC = 32
+       pi_4_high = next_down(y)        # exactly representable with 32 bits
+
+       PREC = 500
+       y1 = (y - pi_4_high) / 2^32
+       PREC = 32
+       pi_4_med = next_down(y1)
+
+       PREC = 500
+       pi_4_low = (y1 - pi_4_med) / 2^32
+
+       pi_4_med *= 2^32
+       pi_4_low *= 2^64
+
+       pi = pi_4_high + pi_4_med + pi_4_low
+
+       printf("pi_4    = %0.112b\n", y)
+       printf("pi_4(3) = %0.112b\n", pi)
+       printf("pi_4_h  = %0.31b\n", pi_4_high)
+       printf("pi_4_m  = %0.31b\n", pi_4_med)
+       printf("pi_4_l  = %0.112b\n", pi_4_low)
+
+       printf("pi_4_high  = %0.36f\n", pi_4_high)
+       printf("pi_4_med   = %0.36e\n", pi_4_med)
+       printf("pi_4_low   = %0.36e\n", pi_4_low)
+}
+
+BEGIN {
+       # test
+
+       z[0] = "501"
+       z[1] = "1.11121e+04"
+       z[2] = "1.2172831e+07"
+       z[3] = "1.13131311113e+09"
+       z[4] = "3.373e+09"
+       z[5] = "8.0e+09"
+       z[6] = "9.1314152e21"
+
+       print "--- test (PREC=113): r = x - q * (pi/4) ---"
+       PREC = 113
+       ROUND_MODE = "N"
+       pi_h = pi_4_high + 0.0
+       pi_m = pi_4_med + 0.0
+       pi_l = pi_4_low + 0.0
+
+       for (ii = 0; ii < length(z); ii++) {
+               PREC = 113
+               x = z[ii];
+               x += 0.0
+               pi_4 = atan2(1, 0) / 2
+               q = int(x / pi_4)
+
+               printf("x = %0.10e, q = %d\n", x, q)
+
+               # calculate with float precision
+               printf("regular math   : %0.32e\n", x - q * pi_4) 
+
+               # calculate with more precision
+               r = x - q * pi_h
+               r -= q * pi_m
+               r -= q * pi_l
+               printf("high-prec math : %0.32e\n", r)
+
+               # extra precision with ap float
+               PREC = 500
+               pi_4 = atan2(1, 0) / 2 
+               r = x - q * pi_4
+               printf("ap math        : %0.32e\n", r)
+       }
+}
+
+BEGIN {
+       print "--- test (PREC=64): r = x - q * (pi/4) ---"
+       PREC = 64
+       ROUND_MODE = "N"
+       pi_h = pi_4_high + 0
+       pi_m = pi_4_med + 0
+       pi_l = pi_4_low + 0
+
+       for (ii = 0; ii < length(z); ii++) {
+               PREC = 64
+               x = z[ii];
+               x += 0.0
+
+               pi_4 = atan2(1, 0) / 2
+               q = int(x / pi_4)
+               printf("x = %0.10e, q = %d\n", x, q)
+
+               r = x - q * pi_4
+               # calculate with float precision
+               printf("regular math   : %0.17e\n", r) 
+
+               # calculate with more precision
+               r = x - q * pi_h
+               r -= q * pi_m
+               r -= q * pi_l
+               printf("high-prec math : %0.17e\n", r)
+
+               # extra precision with ap float
+               PREC = 500
+               pi_4 = atan2(1, 0) / 2 
+               r = x - q * pi_4
+               printf("ap math        : %0.17e\n", r)
+       }
+}
diff --git a/mpfr.c b/mpfr.c
index adcd0d8..faa7f04 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -96,6 +96,9 @@ static NODE *do_mpfp_sqrt(int);
 static NODE *do_mpfp_srand(int);
 static NODE *do_mpfp_strtonum(int);
 static NODE *do_mpfp_xor(int);
+#ifdef NUMDEBUG
+static NODE *do_mpfp_next_down(int);
+#endif
 
 /* internal functions */
 static NODE *mpfp_make_node(unsigned int type);
@@ -207,12 +210,15 @@ mpfp_init(bltin_t **numbr_bltins)
                { "srand",      do_mpfp_srand },
                { "strtonum",   do_mpfp_strtonum },
                { "xor",        do_mpfp_xor },
+#ifdef NUMDEBUG
+               { "next_down",  do_mpfp_next_down },
+#endif
                { NULL, NULL },
        };
        const char *rndmode = DEFAULT_ROUNDMODE;
 
        mpfr_set_default_prec(DEFAULT_PREC);
-       ROUND_MODE = mpfp_get_rounding_mode(rndmode[0]); 
+       ROUND_MODE = mpfp_get_rounding_mode(rndmode[0]);
        mpfr_set_default_rounding_mode(ROUND_MODE);
 
        mpz_init(MNR);
@@ -1503,6 +1509,44 @@ do_mpfp_srand(int nargs)
 }
 
 
+#ifdef NUMDEBUG
+
+/* do_mpfp_next_down --- return the greatest representable float that’s 
strictly less than x. */
+
+static NODE *
+do_mpfp_next_down(int nargs)
+{
+       NODE *tmp, *r;
+
+       tmp = POP_SCALAR();
+       tmp = force_number(tmp);
+
+       if (is_mpfp_integer(tmp)) {
+               /* XXX: have no use. */  
+               fatal(_("next_down: not implemented for an integer"));
+       } else {
+               if (mpfr_nan_p(MPFR_T(tmp->qnumbr)))    /* NaN */
+                       return tmp;
+
+               /*
+                * apply current precision (which can be different from the 
precision of the
+                * input number if changed with an assignment to PREC prior to 
the call),
+                * and round toward minus infinity.
+                */
+               r = mpfp_float();
+               (void) mpfr_set(r->qnumbr, MPFR_T(tmp->qnumbr), MPFR_RNDD);
+
+               /* representable float that’s strictly less than x */
+               mpfr_nextbelow(MPFR_T(r->qnumbr));
+       }
+
+       DEREF(tmp);
+       return r;
+}
+
+#endif
+
+
 /* mpfp_add --- add arbitrary-precision numbers */ 
 
 static NODE *
@@ -1925,6 +1969,10 @@ out_of_range:
        case 'e':
        case 'f':
        case 'E':
+#ifdef NUMDEBUG
+       case 'a':       /* hexadecimal */
+       case 'b':       /* MPFR binary format */
+#endif
                if (is_mpfp_float(arg)) {
                        mf = arg->qnumbr;
                        mpfmt_spec = MP_FLOAT;

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=5f5c0c02c84012a4cb7f418ddb0ca2ec1b5db747

commit 5f5c0c02c84012a4cb7f418ddb0ca2ec1b5db747
Merge: a37db77 21e6675
Author: John Haque <address@hidden>
Date:   Thu Jan 31 13:28:43 2013 -0600

    Merge branch 'num-handler' into long-double


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

Summary of changes:
 awkgram.c                |  397 ++++++++++++++++++++++---------------------
 awkgram.y                |   15 ++-
 configure                |    2 +-
 configure.ac             |    2 +-
 double.c                 |   14 ++-
 format.c                 |    9 +-
 long_double.c            |   11 +-
 long_double.h            |   23 ++-
 misc/ChangeLog           |   11 ++
 misc/Makefile            |   70 ++++++++-
 misc/float128.c          |   34 ++++-
 misc/float80.c           |  138 +++++++++++++++
 misc/floatcmp.awk        |   57 +++++++
 misc/gawk_math.c         |  420 +++++++++++++++++++++++++++++++++++++++++++++-
 misc/ldbl-tests/exp.awk  |   14 ++
 misc/ldbl-tests/log.awk  |    3 +
 misc/ldbl-tests/pow.awk  |   29 ++++
 misc/ldbl-tests/sqrt.awk |    3 +
 misc/ldblin.awk          |   26 +++
 misc/splitlog2.awk       |   49 ++++++
 misc/splitpi4.awk        |  116 +++++++++++++
 mpfr.c                   |   50 ++++++-
 test/dumpvars.ok         |    4 +-
 test/symtab1.ok          |    4 +-
 test/symtab6.ok          |    4 +-
 test/symtab8.ok          |    4 +-
 26 files changed, 1283 insertions(+), 226 deletions(-)
 create mode 100644 misc/ChangeLog
 create mode 100644 misc/float80.c
 create mode 100644 misc/floatcmp.awk
 create mode 100644 misc/ldbl-tests/exp.awk
 create mode 100644 misc/ldbl-tests/log.awk
 create mode 100644 misc/ldbl-tests/pow.awk
 create mode 100644 misc/ldbl-tests/sqrt.awk
 create mode 100644 misc/ldblin.awk
 create mode 100644 misc/splitlog2.awk
 create mode 100644 misc/splitpi4.awk


hooks/post-receive
-- 
gawk



reply via email to

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