[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. b99af9ec0835ba702bcf
From: |
John Haque |
Subject: |
[gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. b99af9ec0835ba702bcf3e62fa36dd76876dc354 |
Date: |
Thu, 12 Apr 2012 02:30:37 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".
The branch, gawk_mpfr has been updated
via b99af9ec0835ba702bcf3e62fa36dd76876dc354 (commit)
from 9bc37b0ee389c9a8be843b9f30d11bb7df899c20 (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=b99af9ec0835ba702bcf3e62fa36dd76876dc354
commit b99af9ec0835ba702bcf3e62fa36dd76876dc354
Author: john haque <address@hidden>
Date: Wed Apr 11 21:11:26 2012 -0500
Change RNDMODE to ROUNDMODE and update doc.
diff --git a/ChangeLog b/ChangeLog
index fb965c4..9dd5a72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-04-11 John Haque <address@hidden>
+
+ * main.c (varinit): Change RNDMODE to ROUNDMODE.
+
2012-04-11 Arnold D. Robbins <address@hidden>
* main.c: Change --arbitrary-precision to --bignum.
diff --git a/FUTURES b/FUTURES
index 03fe71d..62225b1 100644
--- a/FUTURES
+++ b/FUTURES
@@ -22,7 +22,7 @@ For 4.1
Merge xmlgawk XML extensions
- Integrate MPFR to provide high precision arithmetic.
+ DONE: Integrate MPFR to provide high precision arithmetic.
Continue code reviews / code cleanup
diff --git a/README_d/ChangeLog b/README_d/ChangeLog
index 5424385..e319a9c 100644
--- a/README_d/ChangeLog
+++ b/README_d/ChangeLog
@@ -1,3 +1,6 @@
+2012-04-11 John Haque <address@hidden>
+ README.hacking: New file.
+
2012-04-01 John Haque <address@hidden>
README.mpfr: New file.
diff --git a/TODO b/TODO
index ab38248..0b79c02 100644
--- a/TODO
+++ b/TODO
@@ -11,6 +11,8 @@ Really make failure to open a socket a non-fatal error (for
4.1).
?? Scope IDs for IPv6 addresses ??
+Merge the chapter and the appendix on floating-point math (for 4.1).
+
------
Code Review:
diff --git a/awk.h b/awk.h
index b4103d4..ff436cc 100644
--- a/awk.h
+++ b/awk.h
@@ -1018,7 +1018,7 @@ extern NODE *FNR_node, *FS_node, *IGNORECASE_node,
*NF_node;
extern NODE *NR_node, *OFMT_node, *OFS_node, *ORS_node, *RLENGTH_node;
extern NODE *RSTART_node, *RS_node, *RT_node, *SUBSEP_node, *PROCINFO_node;
extern NODE *LINT_node, *ERRNO_node, *TEXTDOMAIN_node, *FPAT_node;
-extern NODE *PREC_node, *RNDMODE_node;
+extern NODE *PREC_node, *ROUNDMODE_node;
extern NODE *Nnull_string;
extern NODE *Null_field;
extern NODE **fields_arr;
@@ -1546,7 +1546,7 @@ extern long getenv_long(const char *name);
/* mpfr.c */
extern void set_PREC(void);
-extern void set_RNDMODE(void);
+extern void set_ROUNDMODE(void);
#ifdef HAVE_MPFR
extern int mpg_cmp(const NODE *, const NODE *);
extern int format_ieee(mpfr_ptr, int);
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2ae1fb9..a54832d 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2012-04-11 John Haque <address@hidden>
+
+ * gawk.texi: Change RNDMODE to ROUNDMODE.
+ * gawk.1, awkcard.in: Ditto.
+
2012-04-11 Arnold D. Robbins <address@hidden>
* gawk.texi: Change --arbitrary-precision to --bignum.
diff --git a/doc/awkcard.in b/doc/awkcard.in
index ef15a8c..ab42e9f 100644
--- a/doc/awkcard.in
+++ b/doc/awkcard.in
@@ -625,7 +625,7 @@ T}
Length of the string matched by \*(FCmatch()\*(FR;
\-1 if no match.
T}
-\*(CB\*(FCRNDMODE\fP T{
+\*(CB\*(FCROUNDMODE\fP T{
The rounding mode to use for arbitrary precision arithmetic,
by default \*(FC"N"\fP.\*(CD
T}
diff --git a/doc/gawk.1 b/doc/gawk.1
index 1f218d3..f01ffbf 100644
--- a/doc/gawk.1
+++ b/doc/gawk.1
@@ -1174,7 +1174,7 @@ the version of
.IR gawk .
.RE
.TP
-.B RNDMODE
+.B ROUNDMODE
The rounding mode to use for arbitrary precision arithmetic on
numbers, by default \fB"N"\fR (IEEE-754 roundTiesToEven mode).
The accepted values are
diff --git a/doc/gawk.texi b/doc/gawk.texi
index d49ac9c..44243b3 100644
--- a/doc/gawk.texi
+++ b/doc/gawk.texi
@@ -12635,8 +12635,8 @@ character. (@xref{Output Separators}.)
The working precision of arbitrary precision floating-point numbers,
53 by default (@pxref{Setting Precision}).
address@hidden @code{RNDMODE} variable
address@hidden RNDMODE #
address@hidden @code{ROUNDMODE} variable
address@hidden ROUNDMODE #
The rounding mode to use for arbitrary precision arithmetic on
numbers, by default @code{"N"} (@samp{roundTiesToEven} in
the IEEE-754 standard)
@@ -18670,7 +18670,7 @@ The @dfn{rounding mode} specifies the behavior for the
results of numerical
operations when discarding extra precision. Each rounding mode indicates
how the least significant returned digit of a rounded result is to
be calculated.
-The @code{RNDMODE} variable (@pxref{Setting Rounding Mode}) provides
+The @code{ROUNDMODE} variable (@pxref{Setting Rounding Mode}) provides
program level control over the rounding mode.
@ref{table-rounding-modes} lists the IEEE-754 defined
rounding modes:
@@ -18678,7 +18678,7 @@ rounding modes:
@float Table,table-rounding-modes
@caption{Rounding Modes}
@multitable @columnfractions .45 .30 .25
address@hidden Rounding Mode @tab IEEE Name @tab @code{RNDMODE}
address@hidden Rounding Mode @tab IEEE Name @tab @code{ROUNDMODE}
@item Round to nearest, ties to even @tab @code{roundTiesToEven} @tab
@code{"N"} or @code{"n"}
@item Round toward plus Infinity @tab @code{roundTowardPositive} @tab
@code{"U"} or @code{"u"}
@item Round toward negative Infinity @tab @code{roundTowardNegative} @tab
@code{"D"} or @code{"d"}
@@ -18771,14 +18771,14 @@ results to any desired precision level supported by
MPFR.
Two built-in
variables @code{PREC}
(@pxref{Setting Precision})
-and @code{RNDMODE}
+and @code{ROUNDMODE}
(@pxref{Setting Rounding Mode})
provide control over the working precision and the rounding mode.
The precision and the rounding mode are set globally for every operation
to follow.
The default working precision for arbitrary precision floats is 53,
-and the default value for @code{RNDMODE} is @code{"N"},
+and the default value for @code{ROUNDMODE} is @code{"N"},
which selects the IEEE-754
@samp{roundTiesToEven} (@pxref{Rounding Mode}) rounding address@hidden
default precision is 53, since according to the MPFR documentation,
@@ -18885,24 +18885,24 @@ issues that occur because numbers are stored
internally in binary.
@node Setting Rounding Mode
@section Setting the Rounding Mode
address@hidden @code{RNDMODE} variable
address@hidden @code{ROUNDMODE} variable
-The built-in variable @code{RNDMODE} has the default value @code{"N"},
+The built-in variable @code{ROUNDMODE} has the default value @code{"N"},
which selects the IEEE-754 rounding mode @samp{roundTiesToEven}.
-The other possible values for @code{RNDMODE} are @code{"U"} for rounding mode
+The other possible values for @code{ROUNDMODE} are @code{"U"} for rounding mode
@samp{roundTowardPositive}, @code{"D"} for @samp{roundTowardNegative},
and @code{"Z"} for @samp{roundTowardZero}.
@command{gawk} also accepts @code{"A"} to select the IEEE-754 mode
@samp{roundTiesToAway}
if your version of the MPFR library supports it; otherwise setting
address@hidden to this value has no effect. @xref{Rounding Mode},
address@hidden to this value has no effect. @xref{Rounding Mode},
for the meanings of the various rounding modes.
Here is an example of how to change the default rounding behavior of
@code{printf}'s output:
@example
-$ @kbd{gawk -M -vRNDMODE="Z" 'BEGIN @{ printf("%.2f\n", 1.378) @}'}
+$ @kbd{gawk -M -vROUNDMODE="Z" 'BEGIN @{ printf("%.2f\n", 1.378) @}'}
@print{} 1.37
@end example
diff --git a/main.c b/main.c
index f8bbb0a..4644926 100644
--- a/main.c
+++ b/main.c
@@ -36,7 +36,7 @@
#define DEFAULT_PROFILE "awkprof.out" /* where to put profile
*/
#define DEFAULT_VARFILE "awkvars.out" /* where to put vars */
#define DEFAULT_PREC 53
-#define DEFAULT_RNDMODE "N" /* round to nearest */
+#define DEFAULT_ROUNDMODE "N" /* round to nearest */
static const char *varfile = DEFAULT_VARFILE;
const char *command_file = NULL; /* debugger commands */
@@ -68,7 +68,7 @@ NODE *ENVIRON_node, *ERRNO_node, *FIELDWIDTHS_node,
*FILENAME_node;
NODE *FNR_node, *FPAT_node, *FS_node, *IGNORECASE_node, *LINT_node;
NODE *NF_node, *NR_node, *OFMT_node, *OFS_node, *ORS_node, *PROCINFO_node;
NODE *RLENGTH_node, *RSTART_node, *RS_node, *RT_node, *SUBSEP_node;
-NODE *PREC_node, *RNDMODE_node;
+NODE *PREC_node, *ROUNDMODE_node;
NODE *TEXTDOMAIN_node;
NODE *_r; /* used as temporary in stack macros */
@@ -572,7 +572,7 @@ out:
#ifdef HAVE_MPFR
/* Set up MPFR defaults, and register pre-exec hook to process
arithmetic opcodes */
if (do_mpfr)
- init_mpfr(DEFAULT_PREC, DEFAULT_RNDMODE);
+ init_mpfr(DEFAULT_PREC, DEFAULT_ROUNDMODE);
#endif
/* load group set */
@@ -965,7 +965,7 @@ static const struct varinit varinit[] = {
{&ORS_node, "ORS", "\n", 0, NULL, set_ORS, TRUE, 0 },
{NULL, "PROCINFO", NULL, 0, NULL, NULL, FALSE, NO_INSTALL |
NON_STANDARD },
{&RLENGTH_node, "RLENGTH", NULL, 0, NULL, NULL, FALSE, 0 },
-{&RNDMODE_node, "RNDMODE", DEFAULT_RNDMODE, 0, NULL, set_RNDMODE,
FALSE, NON_STANDARD },
+{&ROUNDMODE_node, "ROUNDMODE", DEFAULT_ROUNDMODE, 0, NULL,
set_ROUNDMODE, FALSE, NON_STANDARD },
{&RS_node, "RS", "\n", 0, NULL, set_RS, TRUE, 0 },
{&RSTART_node, "RSTART", NULL, 0, NULL, NULL, FALSE, 0 },
{&RT_node, "RT", "", 0, NULL, NULL, FALSE, NON_STANDARD },
diff --git a/mpfr.c b/mpfr.c
index 927f161..c42a663 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -3,7 +3,7 @@
*/
/*
- * Copyright (C) 1986, 1988, 1989, 1991-2012 the Free Software Foundation, Inc.
+ * Copyright (C) 2012 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
@@ -600,15 +600,18 @@ get_rnd_mode(const char rmode)
return -1;
}
-/* set_RNDMODE --- update MPFR rounding mode related variables when RNDMODE
assigned to */
+/*
+ * set_ROUNDMODE --- update MPFR rounding mode related variables
+ * when ROUNDMODE assigned to
+ */
void
-set_RNDMODE()
+set_ROUNDMODE()
{
if (do_mpfr) {
mpfr_rnd_t rndm = -1;
NODE *n;
- n = force_string(RNDMODE_node->var_value);
+ n = force_string(ROUNDMODE_node->var_value);
if (n->stlen == 1)
rndm = get_rnd_mode(n->stptr[0]);
if (rndm != -1) {
diff --git a/test/dumpvars.ok b/test/dumpvars.ok
index 68c6a7b..73d3d30 100644
--- a/test/dumpvars.ok
+++ b/test/dumpvars.ok
@@ -18,7 +18,7 @@ OFS: " "
ORS: "\n"
PREC: 53
RLENGTH: 0
-RNDMODE: "N"
+ROUNDMODE: "N"
RS: "\n"
RSTART: 0
RT: "\n"
diff --git a/test/mpfrrnd.awk b/test/mpfrrnd.awk
index eafefb9..508ac26 100644
--- a/test/mpfrrnd.awk
+++ b/test/mpfrrnd.awk
@@ -3,13 +3,13 @@ BEGIN {
printf(" %.15f\n", N)
printf("* %.10f\n", N) # default
- RNDMODE="N"; printf("N %.10f\n", N)
- RNDMODE="U"; printf("U %.10f\n", N)
- RNDMODE="D"; printf("D %.10f\n", N)
- RNDMODE="Z"; printf("Z %.10f\n", N)
+ ROUNDMODE="N"; printf("N %.10f\n", N)
+ ROUNDMODE="U"; printf("U %.10f\n", N)
+ ROUNDMODE="D"; printf("D %.10f\n", N)
+ ROUNDMODE="Z"; printf("Z %.10f\n", N)
N = -N
- RNDMODE="N"; printf("N %.10f\n", N)
- RNDMODE="U"; printf("U %.10f\n", N)
- RNDMODE="D"; printf("D %.10f\n", N)
- RNDMODE="Z"; printf("Z %.10f\n", N)
+ ROUNDMODE="N"; printf("N %.10f\n", N)
+ ROUNDMODE="U"; printf("U %.10f\n", N)
+ ROUNDMODE="D"; printf("D %.10f\n", N)
+ ROUNDMODE="Z"; printf("Z %.10f\n", N)
}
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 ++++
FUTURES | 2 +-
README_d/ChangeLog | 3 +++
TODO | 2 ++
awk.h | 4 ++--
doc/ChangeLog | 5 +++++
doc/awkcard.in | 2 +-
doc/gawk.1 | 2 +-
doc/gawk.texi | 22 +++++++++++-----------
main.c | 8 ++++----
mpfr.c | 11 +++++++----
test/dumpvars.ok | 2 +-
test/mpfrrnd.awk | 16 ++++++++--------
13 files changed, 50 insertions(+), 33 deletions(-)
hooks/post-receive
--
gawk
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gawk-diffs] [SCM] gawk branch, gawk_mpfr, updated. b99af9ec0835ba702bcf3e62fa36dd76876dc354,
John Haque <=