diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-02 23:02:29 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-02 23:02:29 +0000 |
commit | 1ed0fc30e56b1cdc56689802c4a0b15d7a1a63fa (patch) | |
tree | 478964478defbf08f1e4a583936e54e0f4cabbeb | |
parent | 12934c67bc9f184b0f2cf60173405c488586a7eb (diff) | |
download | mpfr-1ed0fc30e56b1cdc56689802c4a0b15d7a1a63fa.tar.gz |
towards -> toward (consistency).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6407 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | atan2.c | 2 | ||||
-rw-r--r-- | div.c | 2 | ||||
-rw-r--r-- | exp2.c | 2 | ||||
-rw-r--r-- | gen_inverse.h | 2 | ||||
-rw-r--r-- | get_str.c | 2 | ||||
-rw-r--r-- | mpfr-impl.h | 2 | ||||
-rw-r--r-- | mpfr-longlong.h | 2 | ||||
-rw-r--r-- | mpn_exp.c | 2 | ||||
-rw-r--r-- | pow.c | 6 | ||||
-rw-r--r-- | pow_z.c | 2 | ||||
-rw-r--r-- | rec_sqrt.c | 6 | ||||
-rw-r--r-- | rint.c | 4 | ||||
-rw-r--r-- | round_near_x.c | 2 | ||||
-rw-r--r-- | strtofr.c | 4 | ||||
-rw-r--r-- | sub.c | 2 | ||||
-rw-r--r-- | sub1.c | 2 | ||||
-rw-r--r-- | tests/tests.c | 10 | ||||
-rw-r--r-- | tests/texp.c | 6 | ||||
-rw-r--r-- | tests/tli2.c | 2 | ||||
-rw-r--r-- | tests/tsqrt.c | 4 |
20 files changed, 33 insertions, 33 deletions
@@ -200,7 +200,7 @@ mpfr_atan2 (mpfr_ptr dest, mpfr_srcptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) Assuming pz <= -2 emin + 5, we can round away from zero (this is what mpfr_underflow always does on MPFR_RNDN). In the case MPFR_RNDN with |y/x| <= 2^(emin-2), we round - towards zero, as |atan(z)/z| < 1. */ + toward zero, as |atan(z)/z| < 1. */ MPFR_ASSERTN (MPFR_PREC_MAX <= 2 * (mpfr_uexp_t) - MPFR_EMIN_MIN + 5); if (rnd_mode == MPFR_RNDN && MPFR_IS_ZERO (tmp)) @@ -390,7 +390,7 @@ mpfr_div (mpfr_ptr q, mpfr_srcptr u, mpfr_srcptr v, mpfr_rnd_t rnd_mode) else { /* We know the estimated quotient is an upper bound of the exact - quotient (with rounding towards zero), with a difference of at + quotient (with rounding toward zero), with a difference of at most 2 in qp[0]. Thus we can round except when sticky3 is 000...000 or 000...001 for directed rounding, and 100...000 or 100...001 for rounding @@ -80,7 +80,7 @@ mpfr_exp2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) /* 2^x = 1 + x*log(2) + O(x^2) for x near zero, and for |x| <= 1 we have |2^x - 1| <= x < 2^EXP(x). If x > 0 we must round away from 0 (dir=1); - if x < 0 we must round towards 0 (dir=0). */ + if x < 0 we must round toward 0 (dir=0). */ MPFR_SMALL_INPUT_AFTER_SAVE_EXPO (y, __gmpfr_one, - MPFR_GET_EXP (x), 0, MPFR_SIGN(x) > 0, rnd_mode, expo, {}); diff --git a/gen_inverse.h b/gen_inverse.h index 739e54bd9..4d24bcd85 100644 --- a/gen_inverse.h +++ b/gen_inverse.h @@ -87,7 +87,7 @@ FUNCTION (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) } mpfr_ui_div (z, 1, z, MPFR_RNDN); /* the error is less than c_w + 2*c_u*k_u (see algorithms.tex), - where c_w = 1/2, c_u = 1 since z was rounded towards zero, + where c_w = 1/2, c_u = 1 since z was rounded toward zero, thus 1/2 + 2 < 4 */ if (MPFR_LIKELY (MPFR_CAN_ROUND (z, m - 2, precy, rnd_mode))) break; @@ -194,7 +194,7 @@ mpfr_get_str_aux (char *const str, mp_exp_t *const exp, mp_limb_t *const r, /* now rnd1 is either MPFR_RNDD or MPFR_RNDZ -> truncate, or - MPFR_RNDU or MPFR_RNDA -> round towards infinity */ + MPFR_RNDU or MPFR_RNDA -> round toward infinity */ /* round away from zero */ if (rnd1 == MPFR_RNDU || rnd1 == MPFR_RNDA) diff --git a/mpfr-impl.h b/mpfr-impl.h index a60ae288c..b637a3a32 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -1257,7 +1257,7 @@ typedef struct { y is the destination (a mpfr_t), v the value to set (a mpfr_t), err1+err2 with err2 <= 3 the error term (mp_exp_t's), dir (an int) is - the direction of the committed error (if dir = 0, it rounds towards 0, + the direction of the committed error (if dir = 0, it rounds toward 0, if dir=1, it rounds away from 0), rnd the rounding mode. It returns from the function a ternary value in case of success. diff --git a/mpfr-longlong.h b/mpfr-longlong.h index 75356c4b1..f51cf64c5 100644 --- a/mpfr-longlong.h +++ b/mpfr-longlong.h @@ -71,7 +71,7 @@ along with this file. If not, see http://www.gnu.org/licenses/. */ 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator, denominator). Like udiv_qrnnd but the numbers are signed. The quotient - is rounded towards 0. + is rounded toward 0. 5) count_leading_zeros(count, x) counts the number of zero-bits from the msb to the first non-zero bit in the UWtype X. This is the number of @@ -26,7 +26,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #include "mpfr-impl.h" /* this function computes an approximation of b^e in {a, n}, with exponent - stored in exp_r. The computed value is rounded towards zero (truncated). + stored in exp_r. The computed value is rounded toward zero (truncated). It returns an integer f such that the final error is bounded by 2^f ulps, that is: a*2^exp_r <= b^e <= 2^exp_r (a + 2^f), @@ -518,9 +518,9 @@ mpfr_pow (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) MPFR_SAVE_EXPO_MARK (expo); mpfr_init2 (t, 53); /* we want a lower bound on y*log2|x|: - (i) if x > 0, it suffices to round log2(x) towards zero, and - to round y*o(log2(x)) towards zero too; - (ii) if x < 0, we first compute t = o(-x), with rounding towards 1, + (i) if x > 0, it suffices to round log2(x) toward zero, and + to round y*o(log2(x)) toward zero too; + (ii) if x < 0, we first compute t = o(-x), with rounding toward 1, and then follow as in case (1). */ if (MPFR_SIGN (x) > 0) mpfr_log2 (t, x, MPFR_RNDZ); @@ -52,7 +52,7 @@ mpfr_pow_pos_z (mpfr_ptr y, mpfr_srcptr x, mpz_srcptr z, mpfr_rnd_t rnd, int cr) SIZ (absz) = ABS(SIZ(absz)); /* Hack to get abs(z) */ MPFR_MPZ_SIZEINBASE2 (size_z, z); - /* round towards 1 (or -1) to avoid spurious overflow or underflow, + /* round toward 1 (or -1) to avoid spurious overflow or underflow, i.e. if an overflow or underflow occurs, it is a real exception and is not just due to the rounding error. */ rnd1 = (MPFR_EXP(x) >= 1) ? MPFR_RNDZ diff --git a/rec_sqrt.c b/rec_sqrt.c index e0c9f175e..de497a46f 100644 --- a/rec_sqrt.c +++ b/rec_sqrt.c @@ -287,7 +287,7 @@ mpfr_mpn_rec_sqrt (mp_ptr x, mp_prec_t p, and to the 2nd most significant bit of t[tn-1] if as=1 */ /* compute t <- 1 - t, which is B^tn - {t, tn+1}, - with rounding towards -Inf, i.e., rounding the input t towards +Inf. + with rounding toward -Inf, i.e., rounding the input t toward +Inf. We could only modify the low tn - th limbs from t, but it gives only a small speedup, and would make the code more complex. */ @@ -303,8 +303,8 @@ mpfr_mpn_rec_sqrt (mp_ptr x, mp_prec_t p, /* we should add 1 here to get 1-th complement, and subtract 1 for -ulp(th), thus we do nothing */ } - else /* negative case: we want 1 - t rounded towards -Inf, i.e., - th + eps rounded towards +Inf, which is th + ulp(th): + else /* negative case: we want 1 - t rounded toward -Inf, i.e., + th + eps rounded toward +Inf, which is th + ulp(th): we discard the bit corresponding to 1, and we add 1 to the least significant bit of t */ { @@ -153,7 +153,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) Decide the rounding direction here. */ if (rnd_mode == MPFR_RNDN && (rp[0] & (MPFR_LIMB_ONE << sh)) == 0) - { /* halfway cases rounded towards zero */ + { /* halfway cases rounded toward zero */ mp_limb_t a, b; /* a: rounding bit and some of the following bits */ /* b: boundary for a (weight of the rounding bit in a) */ @@ -238,7 +238,7 @@ mpfr_rint (mpfr_ptr r, mpfr_srcptr u, mpfr_rnd_t rnd_mode) rnd_away = 0; /* rounding bit = 0 (not represented in u) */ else if (rnd_mode == MPFR_RNDN && (rp[0] & (MPFR_LIMB_ONE << sh)) == 0) - { /* halfway cases rounded towards zero */ + { /* halfway cases rounded toward zero */ mp_limb_t a, b; /* a: rounding bit and some of the following bits */ /* b: boundary for a (weight of the rounding bit in a) */ diff --git a/round_near_x.c b/round_near_x.c index 9d881adfb..1f0b26d00 100644 --- a/round_near_x.c +++ b/round_near_x.c @@ -38,7 +38,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., y is the destination (a mpfr_t), v the value to set (a mpfr_t), err the error term (a mpfr_uexp_t) such that |g(x)| < 2^(EXP(x)-err), dir (an int) is the direction of the error (if dir = 0, - it rounds towards 0, if dir=1, it rounds away from 0), + it rounds toward 0, if dir=1, it rounds away from 0), rnd the rounding mode. It returns 0 if it can't round. @@ -599,7 +599,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) pstr_size most significant digits from pstr->mant, i.e., the only difference can come from the neglected pstr->prec-pstr_size least significant digits of pstr->mant. - If exact is zero, then z is rounded towards zero with respect + If exact is zero, then z is rounded toward zero with respect to that value. */ /* multiply(y = 0.mant_s[0]...mant_s[pr-1])_base by base^(exp_s-g) */ @@ -710,7 +710,7 @@ parsed_string_to_mpfr (mpfr_t x, struct parsed_string *pstr, mpfr_rnd_t rnd) speedup for rare cases only. */ exact = exact && (pstr_size == pstr->prec); - /* at this point, result is an approximation rounded towards zero + /* at this point, result is an approximation rounded toward zero of the pstr_size most significant digits of pstr->mant, with equality in case exact is non-zero. */ @@ -88,7 +88,7 @@ mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) else { /* signs differ, it's an addition */ if (MPFR_GET_EXP (b) < MPFR_GET_EXP (c)) - { /* exchange rounding modes towards +/- infinity */ + { /* exchange rounding modes toward +/- infinity */ int inexact; rnd_mode = MPFR_INVERT_RND (rnd_mode); if (MPFR_LIKELY (MPFR_PREC (a) == MPFR_PREC (b) @@ -320,7 +320,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t rnd_mode) } } } - else /* directed rounding: set rnd_mode to RNDZ iff towards zero */ + else /* directed rounding: set rnd_mode to RNDZ iff toward zero */ { if (MPFR_IS_RNDUTEST_OR_RNDDNOTTEST(rnd_mode, MPFR_IS_NEG(a))) rnd_mode = MPFR_RNDZ; diff --git a/tests/tests.c b/tests/tests.c index a7525e8f5..1d581c7b4 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -522,11 +522,11 @@ tests_default_random (mpfr_ptr x, int pos, mp_exp_t emin, mp_exp_t emax) } /* The test_one argument is a boolean. If it is true and rnd is a rounding - mode towards infinity, then the function is tested in only one rounding + mode toward infinity, then the function is tested in only one rounding mode (the one provided in rnd) and the variable rndnext is not used (due to - the break). If it is true and rnd is a rounding mode towards or away from + the break). If it is true and rnd is a rounding mode toward or away from zero, then the function is tested twice, first with the provided rounding - mode and second with the rounding mode towards the corresponding infinity + mode and second with the rounding mode toward the corresponding infinity (determined by the sign of the result). If it is false, then the function is tested in the 5 rounding modes, and rnd must initially be MPFR_RNDZ; thus rndnext will be initialized in the first iteration. @@ -610,7 +610,7 @@ test5rm (int (*fct) (FLIST), mpfr_srcptr x, mpfr_ptr y, mpfr_ptr z, x is the input (hexadecimal format) y is the expected output (hexadecimal format) for foo(x) with rounding rnd - If rnd is Z, y is the expected output in round-towards-zero, and the + If rnd is Z, y is the expected output in round-toward-zero, and the four directed rounding modes are tested, then the round-to-nearest mode is tested in precision yprec-1. This is useful for worst cases, where yprec is the minimum value such that one has a worst case in a @@ -871,7 +871,7 @@ bad_cases (int (*fct)(FLIST), int (*inv)(FLIST), char *name, mpfr_out_str (stdout, 16, 0, y, MPFR_RNDN); printf ("\n"); } - /* Note: y is now the expected result rounded towards zero. */ + /* Note: y is now the expected result rounded toward zero. */ test5rm (fct, x, y, z, MPFR_RNDZ, 0, name); next_i: /* In case the exponent range has been changed by diff --git a/tests/texp.c b/tests/texp.c index 79b29fd0e..0b0751a4f 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -72,7 +72,7 @@ check3 (const char *op, mpfr_rnd_t rnd, const char *res) mpfr_clears (x, y, (mpfr_ptr) 0); } -/* expx is the value of exp(X) rounded towards -infinity */ +/* expx is the value of exp(X) rounded toward -infinity */ static void check_worst_case (const char *Xs, const char *expxs) { @@ -83,7 +83,7 @@ check_worst_case (const char *Xs, const char *expxs) test_exp(y, x, MPFR_RNDD); if (mpfr_cmp_str1 (y, expxs)) { - printf ("exp(x) rounded towards -infinity is wrong\n"); + printf ("exp(x) rounded toward -infinity is wrong\n"); exit(1); } mpfr_set_str1(x, Xs); @@ -91,7 +91,7 @@ check_worst_case (const char *Xs, const char *expxs) mpfr_nexttoinf (y); if (mpfr_cmp(x,y)) { - printf ("exp(x) rounded towards +infinity is wrong\n"); + printf ("exp(x) rounded toward +infinity is wrong\n"); exit(1); } mpfr_clears (x, y, (mpfr_ptr) 0); diff --git a/tests/tli2.c b/tests/tli2.c index 26b57b8a4..cfc159758 100644 --- a/tests/tli2.c +++ b/tests/tli2.c @@ -124,7 +124,7 @@ normal (void) exit (1); } - /* round towards zero mode and 5 bits of precision, + /* round toward zero mode and 5 bits of precision, it should be rounded to 2^-2 + 2^-6 */ mpfr_set_prec (y, 5); inexact = mpfr_li2 (y, x, MPFR_RNDZ); diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 6f12063cb..ba6ba71be 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -178,7 +178,7 @@ check_float (void) check24("281474876047360.0", MPFR_RNDD, "1.6777212e7"); check24("91214552498176.0", MPFR_RNDD, "9.550631e6"); - /* check that rounding away is just rounding towards plus infinity */ + /* check that rounding away is just rounding toward plus infinity */ check24("91214552498176.0", MPFR_RNDA, "9.550632e6"); } @@ -679,7 +679,7 @@ main (void) check4 ("72154663483843080704304789585920.0", MPFR_RNDD, "1.e2d9a51977e6d@13"); - /* check that rounding away is just rounding towards plus infinity */ + /* check that rounding away is just rounding toward plus infinity */ check4 ("72154663483843080704304789585920.0", MPFR_RNDA, "1.e2d9a51977e6e@13"); |