diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-02 17:17:59 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-10-02 17:17:59 +0000 |
commit | 29963d6597d7fdc221eef8df533a8ad55bd7425f (patch) | |
tree | 27570a058b82424e0e0b08eb142ff248d4fb17ae /tests | |
parent | c4681b7961763f6c05e2ce4858787d146cde7219 (diff) | |
download | mpfr-29963d6597d7fdc221eef8df533a8ad55bd7425f.tar.gz |
Updated documentation. In particular, mpfr_set_str_raw renamed
as mpfr_set_str_binary. This function and mpfr_print_binary are
now internal functions. mpfr_print_binary no longer prints the
non-significant 0 bits. Updated the source to match the manual.
mpfr_print_binary has been completely rewritten (now directly
prints to stdout, without using an intermediate string). In
mpfr_set_str_binary, replaced atol by strtol + error checking.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2466 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
40 files changed, 242 insertions, 203 deletions
diff --git a/tests/tacosh.c b/tests/tacosh.c index 35ec74b8f..fec59cf5c 100644 --- a/tests/tacosh.c +++ b/tests/tacosh.c @@ -1,6 +1,6 @@ /* Test file for mpfr_acosh. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_acosh diff --git a/tests/tadd.c b/tests/tadd.c index 1481e08c2..af4e719b6 100644 --- a/tests/tadd.c +++ b/tests/tadd.c @@ -104,12 +104,12 @@ check64 (void) mpfr_init (u); mpfr_set_prec (x, 29); - mpfr_set_str_raw (x, "1.1101001000101111011010010110e-3"); + mpfr_set_str_binary (x, "1.1101001000101111011010010110e-3"); mpfr_set_prec (t, 58); - mpfr_set_str_raw (t, "0.11100010011111001001100110010111110110011000000100101E-1"); + mpfr_set_str_binary (t, "0.11100010011111001001100110010111110110011000000100101E-1"); mpfr_set_prec (u, 29); mpfr_add (u, x, t, GMP_RNDD); - mpfr_set_str_raw (t, "1.0101011100001000011100111110e-1"); + mpfr_set_str_binary (t, "1.0101011100001000011100111110e-1"); if (mpfr_cmp (u, t)) { printf ("mpfr_add(u, x, t) failed for prec(x)=29, prec(t)=58\n"); @@ -121,9 +121,9 @@ check64 (void) } mpfr_set_prec (x, 4); - mpfr_set_str_raw (x, "-1.0E-2"); + mpfr_set_str_binary (x, "-1.0E-2"); mpfr_set_prec (t, 2); - mpfr_set_str_raw (t, "-1.1e-2"); + mpfr_set_str_binary (t, "-1.1e-2"); mpfr_set_prec (u, 2); mpfr_add (u, x, t, GMP_RNDN); if (MPFR_MANT(u)[0] << 2) @@ -132,7 +132,7 @@ check64 (void) mpfr_print_binary (u); puts (""); exit (1); } - mpfr_set_str_raw (t, "-1.0e-1"); + mpfr_set_str_binary (t, "-1.0e-1"); if (mpfr_cmp (u, t)) { printf ("mpfr_add(u, x, t) failed for prec(x)=4, prec(t)=2\n"); @@ -143,12 +143,12 @@ check64 (void) } mpfr_set_prec (x, 8); - mpfr_set_str_raw (x, "-0.10011010"); /* -77/128 */ + mpfr_set_str_binary (x, "-0.10011010"); /* -77/128 */ mpfr_set_prec (t, 4); - mpfr_set_str_raw (t, "-1.110e-5"); /* -7/128 */ + mpfr_set_str_binary (t, "-1.110e-5"); /* -7/128 */ mpfr_set_prec (u, 4); mpfr_add (u, x, t, GMP_RNDN); /* should give -5/8 */ - mpfr_set_str_raw (t, "-1.010e-1"); + mpfr_set_str_binary (t, "-1.010e-1"); if (mpfr_cmp (u, t)) { printf ("mpfr_add(u, x, t) failed for prec(x)=8, prec(t)=4\n"); printf ("expected -1.010e-1\n"); @@ -158,8 +158,8 @@ check64 (void) } mpfr_set_prec (x, 112); mpfr_set_prec (t, 98); mpfr_set_prec (u, 54); - mpfr_set_str_raw (x, "-0.11111100100000000011000011100000101101010001000111E-401"); - mpfr_set_str_raw (t, "0.10110000100100000101101100011111111011101000111000101E-464"); + mpfr_set_str_binary (x, "-0.11111100100000000011000011100000101101010001000111E-401"); + mpfr_set_str_binary (t, "0.10110000100100000101101100011111111011101000111000101E-464"); mpfr_add (u, x, t, GMP_RNDN); if (mpfr_cmp (u, x)) { @@ -178,10 +178,10 @@ check64 (void) } mpfr_set_prec(x, 53); mpfr_set_prec(t, 76); mpfr_set_prec(u, 76); - mpfr_set_str_raw(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); - mpfr_set_str_raw(t, "-0.1011000101110010000101111111011111010001110011110111100110101011110010011111"); + mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); + mpfr_set_str_binary(t, "-0.1011000101110010000101111111011111010001110011110111100110101011110010011111"); mpfr_sub(u, x, t, GMP_RNDU); - mpfr_set_str_raw(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100"); + mpfr_set_str_binary(t, "0.1011000101110010000101111111011100111111101010011011110110101011101000000100"); if (mpfr_cmp(u,t)) { printf ("expect "); mpfr_print_binary(t); puts (""); @@ -189,10 +189,10 @@ check64 (void) exit (1); } mpfr_set_prec(x, 53); mpfr_set_prec(t, 108); mpfr_set_prec(u, 108); - mpfr_set_str_raw(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); - mpfr_set_str_raw(t, "-0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111"); + mpfr_set_str_binary(x, "-0.10010010001001011011110000000000001010011011011110001E-32"); + mpfr_set_str_binary(t, "-0.101100010111001000010111111101111101000111001111011110011010101111001001111000111011001110011000000000111111"); mpfr_sub(u, x, t, GMP_RNDU); - mpfr_set_str_raw(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111"); + mpfr_set_str_binary(t, "0.101100010111001000010111111101110011111110101001101111011010101110100000001011000010101110011000000000111111"); if (mpfr_cmp(u,t)) { printf ("expect "); mpfr_print_binary(t); puts (""); @@ -200,26 +200,26 @@ check64 (void) exit (1); } mpfr_set_prec(x, 97); mpfr_set_prec(t, 97); mpfr_set_prec(u, 97); - mpfr_set_str_raw(x, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010000000000000000E-39"); + mpfr_set_str_binary(x, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010000000000000000E-39"); mpfr_set_ui(t, 1, GMP_RNDN); mpfr_add(u, x, t, GMP_RNDN); - mpfr_set_str_raw(x, "0.1000000000000000000000000000000000000000111110110000100000000101100011011110100000101111100010001E1"); + mpfr_set_str_binary(x, "0.1000000000000000000000000000000000000000111110110000100000000101100011011110100000101111100010001E1"); if (mpfr_cmp(u,x)) { printf ("mpfr_add failed for precision 97\n"); exit (1); } mpfr_set_prec(x, 128); mpfr_set_prec(t, 128); mpfr_set_prec(u, 128); - mpfr_set_str_raw(x, "0.10101011111001001010111011001000101100111101000000111111111011010100001100011101010001010111111101111010100110111111100101100010E-4"); + mpfr_set_str_binary(x, "0.10101011111001001010111011001000101100111101000000111111111011010100001100011101010001010111111101111010100110111111100101100010E-4"); mpfr_set(t, x, GMP_RNDN); mpfr_sub(u, x, t, GMP_RNDN); mpfr_set_prec(x, 96); mpfr_set_prec(t, 96); mpfr_set_prec(u, 96); - mpfr_set_str_raw(x, "0.111000000001110100111100110101101001001010010011010011100111100011010100011001010011011011000010E-4"); + mpfr_set_str_binary(x, "0.111000000001110100111100110101101001001010010011010011100111100011010100011001010011011011000010E-4"); mpfr_set(t, x, GMP_RNDN); mpfr_sub(u, x, t, GMP_RNDN); mpfr_set_prec(x, 85); mpfr_set_prec(t, 85); mpfr_set_prec(u, 85); - mpfr_set_str_raw(x, "0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4"); - mpfr_set_str_raw(t, "0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4"); + mpfr_set_str_binary(x, "0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4"); + mpfr_set_str_binary(t, "0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4"); mpfr_sub(u, x, t, GMP_RNDU); mpfr_sub(x, x, t, GMP_RNDU); if (mpfr_cmp(x, u) != 0) @@ -234,8 +234,8 @@ check64 (void) exit (1); } mpfr_set_prec(x, 65); mpfr_set_prec(t, 65); mpfr_set_prec(u, 65); - mpfr_set_str_raw(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); - mpfr_set_str_raw(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); + mpfr_set_str_binary(x, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); + mpfr_set_str_binary(t, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); mpfr_sub(u, x, t, GMP_RNDU); if (mpfr_get_d1 (u) != 9.4349060620538533806e167) { /* 2^558 */ @@ -244,8 +244,8 @@ check64 (void) } mpfr_set_prec(x, 64); mpfr_set_prec(t, 64); mpfr_set_prec(u, 64); - mpfr_set_str_raw(x, "0.1000011110101111011110111111000011101011101111101101101100000100E-220"); - mpfr_set_str_raw(t, "0.1000011110101111011110111111000011101011101111101101010011111101E-220"); + mpfr_set_str_binary(x, "0.1000011110101111011110111111000011101011101111101101101100000100E-220"); + mpfr_set_str_binary(t, "0.1000011110101111011110111111000011101011101111101101010011111101E-220"); mpfr_add(u, x, t, GMP_RNDU); if ((MPFR_MANT(u)[0] & 1) != 1) { @@ -258,32 +258,32 @@ check64 (void) /* bug found by Norbert Mueller, 14 Sep 2000 */ mpfr_set_prec(x, 56); mpfr_set_prec(t, 83); mpfr_set_prec(u, 10); - mpfr_set_str_raw(x, "0.10001001011011001111101100110100000101111010010111010111E-7"); - mpfr_set_str_raw(t, "0.10001001011011001111101100110100000101111010010111010111000000000111110110110000100E-7"); + mpfr_set_str_binary(x, "0.10001001011011001111101100110100000101111010010111010111E-7"); + mpfr_set_str_binary(t, "0.10001001011011001111101100110100000101111010010111010111000000000111110110110000100E-7"); mpfr_sub(u, x, t, GMP_RNDU); /* array bound write found by Norbert Mueller, 26 Sep 2000 */ mpfr_set_prec(x, 109); mpfr_set_prec(t, 153); mpfr_set_prec(u, 95); - mpfr_set_str_raw(x,"0.1001010000101011101100111000110001111111111111111111111111111111111111111111111111111111111111100000000000000E33"); - mpfr_set_str_raw(t,"-0.100101000010101110110011100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100101101000000100100001100110111E33"); + mpfr_set_str_binary(x,"0.1001010000101011101100111000110001111111111111111111111111111111111111111111111111111111111111100000000000000E33"); + mpfr_set_str_binary(t,"-0.100101000010101110110011100011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100101101000000100100001100110111E33"); mpfr_add(u, x, t, GMP_RNDN); /* array bound writes found by Norbert Mueller, 27 Sep 2000 */ mpfr_set_prec(x, 106); mpfr_set_prec(t, 53); mpfr_set_prec(u, 23); - mpfr_set_str_raw(x, "-0.1000011110101111111001010001000100001011000000000000000000000000000000000000000000000000000000000000000000E-59"); - mpfr_set_str_raw(t, "-0.10000111101011111110010100010001101100011100110100000E-59"); + mpfr_set_str_binary(x, "-0.1000011110101111111001010001000100001011000000000000000000000000000000000000000000000000000000000000000000E-59"); + mpfr_set_str_binary(t, "-0.10000111101011111110010100010001101100011100110100000E-59"); mpfr_sub(u, x, t, GMP_RNDN); mpfr_set_prec(x, 177); mpfr_set_prec(t, 217); mpfr_set_prec(u, 160); - mpfr_set_str_raw(x, "-0.111010001011010000111001001010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E35"); - mpfr_set_str_raw(t, "0.1110100010110100001110010010100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011010011100001111001E35"); + mpfr_set_str_binary(x, "-0.111010001011010000111001001010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E35"); + mpfr_set_str_binary(t, "0.1110100010110100001110010010100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111011010011100001111001E35"); mpfr_add(u, x, t, GMP_RNDN); mpfr_set_prec(x, 214); mpfr_set_prec(t, 278); mpfr_set_prec(u, 207); - mpfr_set_str_raw(x, "0.1000100110100110101101101101000000010000100111000001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E66"); - mpfr_set_str_raw(t, "-0.10001001101001101011011011010000000100001001110000010011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111011111001001100011E66"); + mpfr_set_str_binary(x, "0.1000100110100110101101101101000000010000100111000001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E66"); + mpfr_set_str_binary(t, "-0.10001001101001101011011011010000000100001001110000010011100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111011111001001100011E66"); mpfr_add(u, x, t, GMP_RNDN); mpfr_set_prec(x, 32); mpfr_set_prec(t, 247); mpfr_set_prec(u, 223); - mpfr_set_str_raw(x, "0.10000000000000000000000000000000E1"); - mpfr_set_str_raw(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0"); + mpfr_set_str_binary(x, "0.10000000000000000000000000000000E1"); + mpfr_set_str_binary(t, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100000100011110000101110110011101110100110110111111011010111100100000000000000000000000000E0"); mpfr_sub(u, x, t, GMP_RNDN); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) @@ -296,8 +296,8 @@ check64 (void) mpfr_set_prec (x, 65); mpfr_set_prec (t, 65); mpfr_set_prec (u, 65); - mpfr_set_str_raw (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); - mpfr_set_str_raw (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); + mpfr_set_str_binary (x, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); + mpfr_set_str_binary (t, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); mpfr_sub (u, t, x, GMP_RNDU); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) @@ -310,8 +310,8 @@ check64 (void) mpfr_set_prec (x, 107); mpfr_set_prec (t, 107); mpfr_set_prec (u, 107); - mpfr_set_str_raw (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315"); - mpfr_set_str_raw (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350"); + mpfr_set_str_binary (x, "0.10111001001111010010001000000010111111011011011101000001001000101000000000000000000000000000000000000000000E315"); + mpfr_set_str_binary (t, "0.10000000000000000000000000000000000101110100100101110110000001100101011111001000011101111100100100111011000E350"); mpfr_sub (u, x, t, GMP_RNDU); if ((MPFR_MANT(u)[(MPFR_PREC(u)-1)/mp_bits_per_limb] & ((mp_limb_t)1<<(mp_bits_per_limb-1)))==0) @@ -397,9 +397,9 @@ check_case_2 (void) mpfr_init2 (c, 500); mpfr_init2 (d, 800); - mpfr_set_str_raw(a, "1E110"); /* a = 2^110 */ - mpfr_set_str_raw(b, "1E900"); /* b = 2^900 */ - mpfr_set_str_raw(c, "1E500"); /* c = 2^500 */ + mpfr_set_str_binary(a, "1E110"); /* a = 2^110 */ + mpfr_set_str_binary(b, "1E900"); /* b = 2^900 */ + mpfr_set_str_binary(c, "1E500"); /* c = 2^500 */ mpfr_add(c, c, a, GMP_RNDZ); /* c = 2^500 + 2^110 */ mpfr_sub(d, b, c, GMP_RNDZ); /* d = 2^900 - 2^500 - 2^110 */ mpfr_add(b, b, c, GMP_RNDZ); /* b = 2^900 + 2^500 + 2^110 */ @@ -453,9 +453,9 @@ check_inexact (void) mpfr_init (u); mpfr_set_prec (x, 2); - mpfr_set_str_raw (x, "0.1E-4"); + mpfr_set_str_binary (x, "0.1E-4"); mpfr_set_prec (u, 33); - mpfr_set_str_raw (u, "0.101110100101101100000000111100000E-1"); + mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 31); if ((inexact = mpfr_add (y, x, u, GMP_RNDN))) { @@ -464,9 +464,9 @@ check_inexact (void) } mpfr_set_prec (x, 2); - mpfr_set_str_raw (x, "0.1E-4"); + mpfr_set_str_binary (x, "0.1E-4"); mpfr_set_prec (u, 33); - mpfr_set_str_raw (u, "0.101110100101101100000000111100000E-1"); + mpfr_set_str_binary (u, "0.101110100101101100000000111100000E-1"); mpfr_set_prec (y, 28); if ((inexact = mpfr_add (y, x, u, GMP_RNDN))) { diff --git a/tests/tadd_ui.c b/tests/tadd_ui.c index 6f9116201..67c8fc0b6 100644 --- a/tests/tadd_ui.c +++ b/tests/tadd_ui.c @@ -62,7 +62,7 @@ special (void) mpfr_init2 (x, 63); mpfr_init2 (y, 63); - mpfr_set_str_raw (x, "0.110100000000000001110001110010111111000000000101100011100100011"); + mpfr_set_str_binary (x, "0.110100000000000001110001110010111111000000000101100011100100011"); mpfr_add_ui (y, x, 1, GMP_RNDD); mpfr_clear (x); mpfr_clear (y); diff --git a/tests/tagm.c b/tests/tagm.c index a939276d9..ec17d01e6 100644 --- a/tests/tagm.c +++ b/tests/tagm.c @@ -87,9 +87,9 @@ check_large (void) mpfr_init2 (agm, 82); mpfr_set_ui (a, 1, GMP_RNDN); - mpfr_set_str_raw (b, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010E-39"); + mpfr_set_str_binary (b, "0.1111101100001000000001011000110111101000001011111000100001000101010100011111110010E-39"); mpfr_agm (agm, a, b, GMP_RNDN); - mpfr_set_str_raw (a, "0.1110001000111101101010101010101101001010001001001011100101111011110101111001111100E-4"); + mpfr_set_str_binary (a, "0.1110001000111101101010101010101101001010001001001011100101111011110101111001111100E-4"); if (mpfr_cmp (agm, a)) { printf ("mpfr_agm failed for precision 82\n"); diff --git a/tests/tasinh.c b/tests/tasinh.c index 0603e3ade..b65088486 100644 --- a/tests/tasinh.c +++ b/tests/tasinh.c @@ -1,6 +1,6 @@ /* Test file for mpfr_asinh. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_asinh @@ -41,7 +43,7 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 33); mpfr_set_prec (y, 43); - mpfr_set_str_raw (x, "0.111001101100000110011001010000101"); + mpfr_set_str_binary (x, "0.111001101100000110011001010000101"); mpfr_asinh (y, x, GMP_RNDZ); test_generic (2, 100, 25); diff --git a/tests/tatan.c b/tests/tatan.c index a9a1e8e1c..63625db33 100644 --- a/tests/tatan.c +++ b/tests/tatan.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" static void @@ -35,8 +37,8 @@ worst_cases (void) mpfr_init2 (y, 53); mpfr_init2 (z, 53); - mpfr_set_str_raw (x, "1.0000100110000001100111100011001110101110100111011101"); - mpfr_set_str_raw (y, "1.1001101101110100101100110011011101101000011010111110e-1"); + mpfr_set_str_binary (x, "1.0000100110000001100111100011001110101110100111011101"); + mpfr_set_str_binary (y, "1.1001101101110100101100110011011101101000011010111110e-1"); mpfr_atan (z, x, GMP_RNDN); if (mpfr_cmp (y, z)) { diff --git a/tests/tatanh.c b/tests/tatanh.c index 3b7774623..f8e99c4b8 100644 --- a/tests/tatanh.c +++ b/tests/tatanh.c @@ -1,6 +1,6 @@ /* Test file for mpfr_atanh. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_atanh diff --git a/tests/tcan_round.c b/tests/tcan_round.c index cc21a81ed..4afd6ad1e 100644 --- a/tests/tcan_round.c +++ b/tests/tcan_round.c @@ -22,7 +22,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" int @@ -36,14 +38,14 @@ main (void) /* checks that rounds to nearest sets the last bit to zero in case of equal distance */ mpfr_init2 (x, 59); - mpfr_set_str_raw (x, "-0.10010001010111000011110010111010111110000000111101100111111E663"); + mpfr_set_str_binary (x, "-0.10010001010111000011110010111010111110000000111101100111111E663"); if (mpfr_can_round (x, 54, GMP_RNDZ, GMP_RNDZ, 53) != 0) { printf ("Error (1) in mpfr_can_round\n"); exit (1); } - mpfr_set_str_raw (x, "-Inf"); + mpfr_set_str_binary (x, "-Inf"); if (mpfr_can_round (x, 2000, GMP_RNDZ, GMP_RNDZ, 2000) != 0) { printf ("Error (2) in mpfr_can_round\n"); @@ -51,7 +53,7 @@ main (void) } mpfr_set_prec (x, 64); - mpfr_set_str_raw (x, "0.1011001000011110000110000110001111101011000010001110011000000000"); + mpfr_set_str_binary (x, "0.1011001000011110000110000110001111101011000010001110011000000000"); if (mpfr_can_round (x, 65, GMP_RNDN, GMP_RNDN, 54)) { printf ("Error (3) in mpfr_can_round\n"); diff --git a/tests/tcmp.c b/tests/tcmp.c index 66eca4f5e..6415e8778 100644 --- a/tests/tcmp.c +++ b/tests/tcmp.c @@ -42,8 +42,8 @@ main (void) mpfr_set_prec (xx, 2); mpfr_set_prec (yy, 2); - mpfr_set_str_raw(xx, "-0.10E0"); - mpfr_set_str_raw(yy, "-0.10E0"); + mpfr_set_str_binary(xx, "-0.10E0"); + mpfr_set_str_binary(yy, "-0.10E0"); if (mpfr_cmp (xx, yy)) { printf ("mpfr_cmp (xx, yy) returns non-zero for prec=2\n"); @@ -52,16 +52,16 @@ main (void) mpfr_set_prec (xx, 65); mpfr_set_prec (yy, 65); - mpfr_set_str_raw(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); - mpfr_set_str_raw(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); + mpfr_set_str_binary(xx, "0.10011010101000110101010000000011001001001110001011101011111011101E623"); + mpfr_set_str_binary(yy, "0.10011010101000110101010000000011001001001110001011101011111011100E623"); p = 0; if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64) { printf ("Error (1) in mpfr_cmp2\n"); exit (1); } - mpfr_set_str_raw(xx, "0.10100010001110110111000010001000010011111101000100011101000011100"); - mpfr_set_str_raw(yy, "0.10100010001110110111000010001000010011111101000100011101000011011"); + mpfr_set_str_binary(xx, "0.10100010001110110111000010001000010011111101000100011101000011100"); + mpfr_set_str_binary(yy, "0.10100010001110110111000010001000010011111101000100011101000011011"); p = 0; if (mpfr_cmp2(xx, yy, &p) <= 0 || p != 64) { @@ -70,8 +70,8 @@ main (void) } mpfr_set_prec (xx, 160); mpfr_set_prec (yy, 160); - mpfr_set_str_raw (xx, "0.1E1"); - mpfr_set_str_raw (yy, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100"); + mpfr_set_str_binary (xx, "0.1E1"); + mpfr_set_str_binary (yy, "0.1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000110001110100"); p = 0; if (mpfr_cmp2 (xx, yy, &p) <= 0 || p != 144) { diff --git a/tests/tcmp2.c b/tests/tcmp2.c index 5331263f2..a2ae6e6cc 100644 --- a/tests/tcmp2.c +++ b/tests/tcmp2.c @@ -192,8 +192,8 @@ special (void) /* bug found by Nathalie Revol, 21 March 2001 */ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); - mpfr_set_str_raw (x, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); - mpfr_set_str_raw (y, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); + mpfr_set_str_binary (x, "0.10000000000000000000000000000000000001110010010110100110011110000E1"); + mpfr_set_str_binary (y, "0.11100100101101001100111011111111110001101001000011101001001010010E-35"); j = 0; if (mpfr_cmp2 (x, y, &j) <= 0 || j != 1) { @@ -209,8 +209,8 @@ special (void) } mpfr_set_prec(x, 127); mpfr_set_prec(y, 127); - mpfr_set_str_raw(x, "0.1011010000110111111000000101011110110001000101101011011110010010011110010000101101000010011001100110010000000010110000101000101E6"); - mpfr_set_str_raw(y, "0.1011010000110111111000000101011011111100011101000011001111000010100010100110110100110010011001100110010000110010010110000010110E6"); + mpfr_set_str_binary(x, "0.1011010000110111111000000101011110110001000101101011011110010010011110010000101101000010011001100110010000000010110000101000101E6"); + mpfr_set_str_binary(y, "0.1011010000110111111000000101011011111100011101000011001111000010100010100110110100110010011001100110010000110010010110000010110E6"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 32) { @@ -222,8 +222,8 @@ special (void) } mpfr_set_prec (x, 128); mpfr_set_prec (y, 239); - mpfr_set_str_raw (x, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100100000000000E167"); - mpfr_set_str_raw (y, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100011111111111111111111111111111111111111111111111011111100101011100011001101000100111000010000000000101100110000111111000101E167"); + mpfr_set_str_binary (x, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100100000000000E167"); + mpfr_set_str_binary (y, "0.10001000110110000111011000101011111100110010010011001101000011111010010110001000000010100110100111111011011010101100011111111111111111111111111111111111111111111111011111100101011100011001101000100111000010000000000101100110000111111000101E167"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 164) { @@ -236,8 +236,8 @@ special (void) /* bug found by Nathalie Revol, 29 March 2001 */ mpfr_set_prec (x, 130); mpfr_set_prec (y, 130); - mpfr_set_str_raw (x, "0.1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E2"); - mpfr_set_str_raw (y, "0.1011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100E2"); + mpfr_set_str_binary (x, "0.1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E2"); + mpfr_set_str_binary (y, "0.1011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100E2"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 127) { @@ -251,7 +251,7 @@ special (void) /* bug found by Nathalie Revol, 2 Apr 2001 */ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); mpfr_set_ui (x, 5, GMP_RNDN); - mpfr_set_str_raw (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3"); + mpfr_set_str_binary (y, "0.10011111111111111111111111111111111111111111111111111111111111101E3"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { @@ -264,8 +264,8 @@ special (void) /* bug found by Nathalie Revol, 2 Apr 2001 */ mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); - mpfr_set_str_raw (x, "0.10011011111000101001110000000000000000000000000000000000000000000E-69"); - mpfr_set_str_raw (y, "0.10011011111000101001101111111111111111111111111111111111111111101E-69"); + mpfr_set_str_binary (x, "0.10011011111000101001110000000000000000000000000000000000000000000E-69"); + mpfr_set_str_binary (y, "0.10011011111000101001101111111111111111111111111111111111111111101E-69"); j = 0; if (mpfr_cmp2(x, y, &j) <= 0 || j != 63) { diff --git a/tests/tcos.c b/tests/tcos.c index b47ea9e93..03bc15711 100644 --- a/tests/tcos.c +++ b/tests/tcos.c @@ -105,9 +105,9 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 30); mpfr_set_prec (y, 30); - mpfr_set_str_raw (x, "1.00001010001101110010100010101e-1"); + mpfr_set_str_binary (x, "1.00001010001101110010100010101e-1"); mpfr_cos (y, x, GMP_RNDU); - mpfr_set_str_raw (x, "1.10111100010101011110101010100e-1"); + mpfr_set_str_binary (x, "1.10111100010101011110101010100e-1"); if (mpfr_cmp (y, x)) { printf ("Error for prec=30, rnd=GMP_RNDU\n"); @@ -118,9 +118,9 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 59); mpfr_set_prec (y, 59); - mpfr_set_str_raw (x, "1.01101011101111010011111110111111111011011101100111100011e-3"); + mpfr_set_str_binary (x, "1.01101011101111010011111110111111111011011101100111100011e-3"); mpfr_cos (y, x, GMP_RNDU); - mpfr_set_str_raw (x, "1.1111011111110010001001001011100111101110100010000010010011e-1"); + mpfr_set_str_binary (x, "1.1111011111110010001001001011100111101110100010000010010011e-1"); if (mpfr_cmp (y, x)) { printf ("Error for prec=59, rnd=GMP_RNDU\n"); @@ -131,9 +131,9 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 5); mpfr_set_prec (y, 5); - mpfr_set_str_raw (x, "1.1100e-2"); + mpfr_set_str_binary (x, "1.1100e-2"); mpfr_cos (y, x, GMP_RNDD); - mpfr_set_str_raw (x, "1.1100e-1"); + mpfr_set_str_binary (x, "1.1100e-1"); if (mpfr_cmp (y, x)) { printf ("Error for x=1.1100e-2, rnd=GMP_RNDD\n"); diff --git a/tests/tcosh.c b/tests/tcosh.c index bd431af8a..441966cd5 100644 --- a/tests/tcosh.c +++ b/tests/tcosh.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_cosh diff --git a/tests/tdiv.c b/tests/tdiv.c index 7f1c71da8..18331bf26 100644 --- a/tests/tdiv.c +++ b/tests/tdiv.c @@ -137,17 +137,17 @@ check_convergence (void) mpfr_t x, y; int i, j; mpfr_init2(x, 130); - mpfr_set_str_raw(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944"); + mpfr_set_str_binary(x, "0.1011111101011010101000001010011111101000011100011101010011111011000011001010000000111100100111110011001010110100100001001000111001E6944"); mpfr_init2(y, 130); mpfr_set_ui(y, 5, GMP_RNDN); mpfr_div(x, x, y, GMP_RNDD); /* exact division */ mpfr_set_prec(x, 64); mpfr_set_prec(y, 64); - mpfr_set_str_raw(x, "0.10010010011011010100101001010111100000101110010010101E55"); - mpfr_set_str_raw(y, "0.1E585"); + mpfr_set_str_binary(x, "0.10010010011011010100101001010111100000101110010010101E55"); + mpfr_set_str_binary(y, "0.1E585"); mpfr_div(x, x, y, GMP_RNDN); - mpfr_set_str_raw(y, "0.10010010011011010100101001010111100000101110010010101E-529"); + mpfr_set_str_binary(y, "0.10010010011011010100101001010111100000101110010010101E-529"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_div for prec=64, rnd=GMP_RNDN\n"); @@ -343,9 +343,9 @@ check_inexact (void) mpfr_init (u); mpfr_set_prec (x, 33); - mpfr_set_str_raw (x, "0.101111100011011101010011101100001E0"); + mpfr_set_str_binary (x, "0.101111100011011101010011101100001E0"); mpfr_set_prec (u, 2); - mpfr_set_str_raw (u, "0.1E0"); + mpfr_set_str_binary (u, "0.1E0"); mpfr_set_prec (y, 28); if ((inexact = mpfr_div (y, x, u, GMP_RNDN) >= 0)) { @@ -355,9 +355,9 @@ check_inexact (void) } mpfr_set_prec (x, 129); - mpfr_set_str_raw (x, "0.111110101111001100000101011100101100110011011101010001000110110101100101000010000001110110100001101010001010100010001111001101010E-2"); + mpfr_set_str_binary (x, "0.111110101111001100000101011100101100110011011101010001000110110101100101000010000001110110100001101010001010100010001111001101010E-2"); mpfr_set_prec (u, 15); - mpfr_set_str_raw (u, "0.101101000001100E-1"); + mpfr_set_str_binary (u, "0.101101000001100E-1"); mpfr_set_prec (y, 92); if ((inexact = mpfr_div (y, x, u, GMP_RNDN) <= 0)) { @@ -486,8 +486,8 @@ main (int argc, char *argv[]) mpfr_init2 (y, 64); mpfr_init2 (z, 64); - mpfr_set_str_raw(x, "1.00100100110110101001010010101111000001011100100101010000000000E54"); - mpfr_set_str_raw(y, "1.00000000000000000000000000000000000000000000000000000000000000E584"); + mpfr_set_str_binary(x, "1.00100100110110101001010010101111000001011100100101010000000000E54"); + mpfr_set_str_binary(y, "1.00000000000000000000000000000000000000000000000000000000000000E584"); mpfr_div(z, x, y, GMP_RNDU); check_nan (); diff --git a/tests/tdiv_ui.c b/tests/tdiv_ui.c index ced6cd364..8e468bdfa 100644 --- a/tests/tdiv_ui.c +++ b/tests/tdiv_ui.c @@ -24,7 +24,9 @@ MA 02111-1307, USA. */ #include <float.h> #include <time.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" static void @@ -79,9 +81,9 @@ special (void) /* bug found by Norbert Mueller, 21 Aug 2001 */ mpfr_set_prec (x, 110); mpfr_set_prec (y, 60); - mpfr_set_str_raw (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44"); + mpfr_set_str_binary (x, "0.110101110011111110011111001110011001110111000000111110001000111011000011E-44"); mpfr_div_ui (y, x, 17, GMP_RNDN); - mpfr_set_str_raw (x, "0.11001010100101100011101110000001100001010110101001010011011E-48"); + mpfr_set_str_binary (x, "0.11001010100101100011101110000001100001010110101001010011011E-48"); if (mpfr_cmp (x, y)) { printf ("Error in x/17 for x=1/16!\n"); @@ -96,7 +98,7 @@ special (void) for (xprec = 53; xprec <= 128; xprec++) { mpfr_set_prec (x, xprec); - mpfr_set_str_raw (x, "0.1100100100001111110011111000000011011100001100110111E2"); + mpfr_set_str_binary (x, "0.1100100100001111110011111000000011011100001100110111E2"); for (yprec = 53; yprec <= 128; yprec++) { mpfr_set_prec (y, yprec); diff --git a/tests/terf.c b/tests/terf.c index 5b476d863..7f6bf7fea 100644 --- a/tests/terf.c +++ b/tests/terf.c @@ -24,7 +24,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" static void @@ -140,7 +142,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, 1.0, GMP_RNDN); mpfr_erf (x, x, GMP_RNDN); - mpfr_set_str_raw (y, "0.11010111101110110011110100111010000010000100010001011"); + mpfr_set_str_binary (y, "0.11010111101110110011110100111010000010000100010001011"); if (mpfr_cmp (x, y)) { printf ("mpfr_erf failed for x=1.0, rnd=GMP_RNDN\n"); @@ -167,7 +169,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, 6.6, GMP_RNDN); mpfr_erf (x, x, GMP_RNDZ); - mpfr_set_str_raw (y, "0.11111111111111111111111111111111111111111111111111111"); + mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111"); if (mpfr_cmp (x, y)) { printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDZ\n"); @@ -182,7 +184,7 @@ main (int argc, char *argv[]) mpfr_set_d (x, 4.5, GMP_RNDN); mpfr_erf (x, x, GMP_RNDN); - mpfr_set_str_raw (y, "0.1111111111111111111111111111111100100111110100011"); + mpfr_set_str_binary (y, "0.1111111111111111111111111111111100100111110100011"); if (mpfr_cmp (x, y)) { printf ("mpfr_erf failed for x=4.5, rnd=GMP_RNDN\n"); @@ -197,9 +199,9 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 120); mpfr_set_prec (y, 120); - mpfr_set_str_raw (x, "0.110100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011E3"); + mpfr_set_str_binary (x, "0.110100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011E3"); mpfr_erf (x, x, GMP_RNDN); - mpfr_set_str_raw (y, "0.11111111111111111111111111111111111111111111111111111111111111111100111111000100111011111011010000110101111100011001101"); + mpfr_set_str_binary (y, "0.11111111111111111111111111111111111111111111111111111111111111111100111111000100111011111011010000110101111100011001101"); if (mpfr_cmp (x, y)) { printf ("mpfr_erf failed for x=6.6, rnd=GMP_RNDN\n"); diff --git a/tests/texceptions.c b/tests/texceptions.c index 758522968..6fee9f506 100644 --- a/tests/texceptions.c +++ b/tests/texceptions.c @@ -200,7 +200,7 @@ main (int argc, char *argv[]) mpfr_set_ui (x, 1, GMP_RNDN); mpfr_div_2exp (x, x, 1022, GMP_RNDN); - mpfr_set_str_raw (y, "1.1e-1022"); /* y = 3/2*x */ + mpfr_set_str_binary (y, "1.1e-1022"); /* y = 3/2*x */ mpfr_sub (y, y, x, GMP_RNDZ); if (mpfr_cmp_ui (y, 0)) { diff --git a/tests/texp.c b/tests/texp.c index bd8d1c8d9..5d246f7a2 100644 --- a/tests/texp.c +++ b/tests/texp.c @@ -231,12 +231,12 @@ check_special () /* bug reported by Franky Backeljauw, 28 Mar 2003 */ mpfr_init2 (x, 53); mpfr_init2 (y, 53); - mpfr_set_str_raw (x, "1.1101011000111101011110000111010010101001101001110111e28"); + mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28"); mpfr_exp (y, x, GMP_RNDN); mpfr_set_prec (x, 153); mpfr_init2 (z, 153); - mpfr_set_str_raw (x, "1.1101011000111101011110000111010010101001101001110111e28"); + mpfr_set_str_binary (x, "1.1101011000111101011110000111010010101001101001110111e28"); mpfr_exp (z, x, GMP_RNDN); mpfr_prec_round (z, 53, GMP_RNDN); diff --git a/tests/texpm1.c b/tests/texpm1.c index c1e1d54fa..fdb69d470 100644 --- a/tests/texpm1.c +++ b/tests/texpm1.c @@ -1,6 +1,6 @@ /* Test file for mpfr_expm1. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tsinh.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_expm1 diff --git a/tests/tfma.c b/tests/tfma.c index e86a7c125..f3941e8f0 100644 --- a/tests/tfma.c +++ b/tests/tfma.c @@ -56,9 +56,9 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 27); mpfr_set_prec (z, 27); mpfr_set_prec (s, 27); - mpfr_set_str_raw (x, "1.11111111111111111111111111e-1"); + mpfr_set_str_binary (x, "1.11111111111111111111111111e-1"); mpfr_set (y, x, GMP_RNDN); - mpfr_set_str_raw (z, "-1.00011110100011001011001001e-1"); + mpfr_set_str_binary (z, "-1.00011110100011001011001001e-1"); if (mpfr_fma (s, x, y, z, GMP_RNDN) >= 0) { printf ("Wrong inexact flag for x=y=1-2^(-27)\n"); diff --git a/tests/tget_str.c b/tests/tget_str.c index 04ff98621..6a43d1a90 100644 --- a/tests/tget_str.c +++ b/tests/tget_str.c @@ -26,6 +26,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" static void @@ -169,7 +170,7 @@ check_small (void) (*__gmp_free_func) (s, strlen (s) + 1); mpfr_set_prec (x, 38); - mpfr_set_str_raw (x, "1.0001110111110100011010100010010100110e-6"); + mpfr_set_str_binary (x, "1.0001110111110100011010100010010100110e-6"); s = mpfr_get_str (NULL, &e, 8, 10, x, GMP_RNDU); if (strcmp (s, "1073721522") || (e != -1)) { @@ -179,7 +180,7 @@ check_small (void) (*__gmp_free_func) (s, strlen (s) + 1); mpfr_set_prec (x, 53); - mpfr_set_str_raw (x, "0.11010111011101100010000100010101110001000000010111001E454"); + mpfr_set_str_binary (x, "0.11010111011101100010000100010101110001000000010111001E454"); s = mpfr_get_str (NULL, &e, 19, 12, x, GMP_RNDU); if (strcmp (s, "b1cgfa4gha0h") || (e != 107)) { diff --git a/tests/thypot.c b/tests/thypot.c index 4a9440a14..772a3ca21 100644 --- a/tests/thypot.c +++ b/tests/thypot.c @@ -63,8 +63,8 @@ test_large (void) mpfr_set_prec (x, 53); mpfr_set_prec (t, 53); mpfr_set_prec (y, 53); - mpfr_set_str_raw (x, "0.11101100011110000011101000010101010011001101000001100E-1021"); - mpfr_set_str_raw (t, "0.11111001010011000001110110001101011100001000010010100E-1021"); + mpfr_set_str_binary (x, "0.11101100011110000011101000010101010011001101000001100E-1021"); + mpfr_set_str_binary (t, "0.11111001010011000001110110001101011100001000010010100E-1021"); mpfr_hypot (y, x, t, GMP_RNDN); mpfr_clear (x); diff --git a/tests/tlog.c b/tests/tlog.c index c8e183c2c..024992f79 100644 --- a/tests/tlog.c +++ b/tests/tlog.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdlib.h> #include <time.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #if (BITS_PER_LONGINT == 32) diff --git a/tests/tlog10.c b/tests/tlog10.c index 241bf171e..b372537b1 100644 --- a/tests/tlog10.c +++ b/tests/tlog10.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_log10 diff --git a/tests/tlog1p.c b/tests/tlog1p.c index 5f63b5834..b00d49245 100644 --- a/tests/tlog1p.c +++ b/tests/tlog1p.c @@ -1,6 +1,6 @@ /* Test file for mpfr_log1p. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tsinh.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_log1p diff --git a/tests/tlog2.c b/tests/tlog2.c index 77138586d..f4aae6657 100644 --- a/tests/tlog2.c +++ b/tests/tlog2.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_log2 diff --git a/tests/tmul.c b/tests/tmul.c index aa28c6eac..959c4cde3 100644 --- a/tests/tmul.c +++ b/tests/tmul.c @@ -195,8 +195,8 @@ check_exact (void) mpfr_set_prec (a, 17); mpfr_set_prec (b, 17); mpfr_set_prec (c, 32); - mpfr_set_str_raw (a, "1.1000111011000100e-1"); - mpfr_set_str_raw (b, "1.0010001111100111e-1"); + mpfr_set_str_binary (a, "1.1000111011000100e-1"); + mpfr_set_str_binary (b, "1.0010001111100111e-1"); if (mpfr_mul (c, a, b, GMP_RNDZ)) { printf ("wrong return value (1)\n"); diff --git a/tests/tmul_ui.c b/tests/tmul_ui.c index cafef1614..9d8d28798 100644 --- a/tests/tmul_ui.c +++ b/tests/tmul_ui.c @@ -155,9 +155,9 @@ main (int argc, char *argv[]) mpfr_set_prec (x, 9); mpfr_set_prec (y, 9); - mpfr_set_str_raw (y, "0.100001111E9"); /* 271 */ + mpfr_set_str_binary (y, "0.100001111E9"); /* 271 */ mpfr_mul_ui (x, y, 1335, GMP_RNDN); - mpfr_set_str_raw (y, "0.101100001E19"); /* 361472 */ + mpfr_set_str_binary (y, "0.101100001E19"); /* 361472 */ if (mpfr_cmp (x, y)) { printf ("Error in mul_ui for 1335*(0.100001111E9)\n"); @@ -168,10 +168,10 @@ main (int argc, char *argv[]) mpfr_set_prec(y, 100); mpfr_set_prec(x, 100); /* y = 1199781142214086656 */ - mpfr_set_str_raw(y, "0.1000010100110011110101001011110010101111000100001E61"); + mpfr_set_str_binary(y, "0.1000010100110011110101001011110010101111000100001E61"); mpfr_mul_ui(x, y, 121, GMP_RNDD); /* 121*y = 145173518207904485376, representable exactly */ - mpfr_set_str_raw(y, "0.1111101111010101111111100011010010111010111110110011001E67"); + mpfr_set_str_binary(y, "0.1111101111010101111111100011010010111010111110110011001E67"); if (mpfr_cmp(x, y)) { printf("Error for 121*y: expected result is:\n"); @@ -179,15 +179,15 @@ main (int argc, char *argv[]) } mpfr_set_prec (x, 32); - mpfr_set_str_raw (x, "0.10000000000000000000000000000000E1"); + mpfr_set_str_binary (x, "0.10000000000000000000000000000000E1"); mpfr_set_prec (y, 93); mpfr_mul_ui (y, x, 1, GMP_RNDN); mpfr_set_prec (x, 287); - mpfr_set_str_raw (x, "0.1111E7"); + mpfr_set_str_binary (x, "0.1111E7"); mpfr_set_prec (y, 289); mpfr_mul_ui (y, x, 6, GMP_RNDN); - mpfr_set_str_raw (x, "0.101101E10"); + mpfr_set_str_binary (x, "0.101101E10"); if (mpfr_cmp (x, y)) { printf ("Error for 6 * 120\n"); @@ -198,7 +198,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 64); mpfr_set_d (x, 2143861251406875.0, GMP_RNDN); mpfr_mul_ui (y, x, 23, GMP_RNDN); - mpfr_set_str_raw (x, "10101111001011100001100110101111110001010010011001101101.0"); + mpfr_set_str_binary (x, "10101111001011100001100110101111110001010010011001101101.0"); if (mpfr_cmp (x, y)) { printf ("Error for 23 * 2143861251406875.0\n"); @@ -211,7 +211,7 @@ main (int argc, char *argv[]) for (xprec = 53; xprec <= 128; xprec++) { mpfr_set_prec (x, xprec); - mpfr_set_str_raw (x, "0.1100100100001111110011111000000011011100001100110111E2"); + mpfr_set_str_binary (x, "0.1100100100001111110011111000000011011100001100110111E2"); for (yprec = 53; yprec <= 128; yprec++) { mpfr_set_prec (y, yprec); diff --git a/tests/tout_str.c b/tests/tout_str.c index f0b3b7b8d..d3c639397 100644 --- a/tests/tout_str.c +++ b/tests/tout_str.c @@ -27,6 +27,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" FILE *fout; @@ -54,7 +55,7 @@ check_large (void) mpfr_init(x); mpfr_set_prec (x, 7); - mpfr_set_str_raw (x, "0.1010101E10"); + mpfr_set_str_binary (x, "0.1010101E10"); s = mpfr_get_str (NULL, &e, 10, 2, x, GMP_RNDU); (*__gmp_free_func) (s, strlen (s) + 1); @@ -84,12 +85,12 @@ check_large (void) /* bug found by Jean-Pierre Merlet, produced error in mpfr_get_str */ mpfr_set_prec (x, 128); - mpfr_set_str_raw (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3"); + mpfr_set_str_binary (x, "0.10111001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011001100110011010E3"); s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDU); (*__gmp_free_func) (s, strlen (s) + 1); mpfr_set_prec (x, 381); - mpfr_set_str_raw (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010"); + mpfr_set_str_binary (x, "0.111111111111111111111111111111111111111111111111111111111111111111101110110000100110011101101101001010111000101111000100100011110101010110101110100000010100001000110100000100011111001000010010000010001010111001011110000001110010111101100001111000101101100000010110000101100100000101010110010110001010100111001111100011100101100000100100111001100010010011110011011010110000001000010"); s = mpfr_get_str (NULL, &e, 10, 0, x, GMP_RNDD); if (e != 0) { diff --git a/tests/tpow.c b/tests/tpow.c index 3512b6ef6..368c29199 100644 --- a/tests/tpow.c +++ b/tests/tpow.c @@ -146,9 +146,9 @@ special () mpfr_set_prec (y, 64); mpfr_set_prec (z, 64); mpfr_set_prec (t, 64); - mpfr_set_str_raw (x, "0.111011000111100000111010000101010100110011010000011"); - mpfr_set_str_raw (y, "0.111110010100110000011101100011010111000010000100101"); - mpfr_set_str_raw (t, "0.1110110011110110001000110100100001001111010011111000010000011001"); + mpfr_set_str_binary (x, "0.111011000111100000111010000101010100110011010000011"); + mpfr_set_str_binary (y, "0.111110010100110000011101100011010111000010000100101"); + mpfr_set_str_binary (t, "0.1110110011110110001000110100100001001111010011111000010000011001"); ; mpfr_pow (z, x, y, GMP_RNDN); if (mpfr_cmp (z, t)) diff --git a/tests/tset.c b/tests/tset.c index ba7939cef..379c1c623 100644 --- a/tests/tset.c +++ b/tests/tset.c @@ -22,7 +22,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" int @@ -42,10 +44,10 @@ main (void) inexact = mpfr_init_set_d (u, 1.0, GMP_RNDN); mpfr_set_prec (y, 11); - mpfr_set_str_raw (y, "0.11111111100E-8"); + mpfr_set_str_binary (y, "0.11111111100E-8"); mpfr_set_prec (x, 2); mpfr_set (x, y, GMP_RNDN); - mpfr_set_str_raw (y, "1.0E-8"); + mpfr_set_str_binary (y, "1.0E-8"); if (mpfr_cmp (x, y)) { printf ("Error for y=0.11111111100E-8, prec=2, rnd=GMP_RNDN\n"); diff --git a/tests/tset_d.c b/tests/tset_d.c index ba5937b40..8488f30a4 100644 --- a/tests/tset_d.c +++ b/tests/tset_d.c @@ -26,6 +26,7 @@ MA 02111-1307, USA. */ #include "gmp.h" #include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" int diff --git a/tests/tset_str.c b/tests/tset_str.c index bd17b5d12..1f8b73ff7 100644 --- a/tests/tset_str.c +++ b/tests/tset_str.c @@ -45,7 +45,7 @@ main (int argc, char *argv[]) { prec = (argc>=3) ? atoi(argv[2]) : 53; mpfr_init2 (x, prec); - mpfr_set_str_raw (x, argv[1]); + mpfr_set_str_binary (x, argv[1]); mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); puts (""); mpfr_clear (x); @@ -80,10 +80,10 @@ main (int argc, char *argv[]) sprintf (str2, "%d", (int) (randlimb () & INT_MAX) + INT_MIN/2); mpfr_set_prec (x, nc + 10); - mpfr_set_str_raw (x, str); + mpfr_set_str_binary (x, str); mpfr_set_prec (x, 54); - mpfr_set_str_raw (x, "0.100100100110110101001010010101111000001011100100101010E-529"); + mpfr_set_str_binary (x, "0.100100100110110101001010010101111000001011100100101010E-529"); mpfr_init2 (y, 54); mpfr_set_str (y, "4.936a52bc17254@-133", 16, GMP_RNDN); if (mpfr_cmp (x, y)) @@ -98,7 +98,7 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str_raw (x, "0.111111101101110010111010100110000111011001010100001101E-529"); + mpfr_set_str_binary (x, "0.111111101101110010111010100110000111011001010100001101E-529"); mpfr_set_str (y, "0.fedcba98765434P-529", 16, GMP_RNDN); if (mpfr_cmp (x, y)) { @@ -115,23 +115,23 @@ main (int argc, char *argv[]) (*__gmp_free_func) (str, nc * sizeof(char)); mpfr_set_prec (x, 53); - mpfr_set_str_raw (x, "+110101100.01010000101101000000100111001000101011101110E00"); + mpfr_set_str_binary (x, "+110101100.01010000101101000000100111001000101011101110E00"); - mpfr_set_str_raw (x, "1.0"); + mpfr_set_str_binary (x, "1.0"); if (mpfr_get_d1 (x) != 1.0) { - printf ("Error in mpfr_set_str_raw for s=1.0\n"); + printf ("Error in mpfr_set_str_binary for s=1.0\n"); mpfr_clear(x); mpfr_clear(y); exit(1); } - mpfr_set_str_raw (x, "+0000"); - mpfr_set_str_raw (x, "+0000E0"); - mpfr_set_str_raw (x, "0000E0"); + mpfr_set_str_binary (x, "+0000"); + mpfr_set_str_binary (x, "+0000E0"); + mpfr_set_str_binary (x, "0000E0"); if (mpfr_get_d1 (x) != 0.0) { - printf ("Error in mpfr_set_str_raw for s=0.0\n"); + printf ("Error in mpfr_set_str_binary for s=0.0\n"); mpfr_clear (x); mpfr_clear (y); exit (1); @@ -258,7 +258,7 @@ main (int argc, char *argv[]) /* in this example an overflow can occur */ mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); - mpfr_set_str_raw (x, "1.0E-532"); + mpfr_set_str_binary (x, "1.0E-532"); mpfr_set_str (y, "0.71128279983522479470@-160", 10, GMP_RNDU); if (mpfr_cmp (x, y)) { @@ -278,7 +278,7 @@ main (int argc, char *argv[]) this result is the same as mpfr_set_str */ mpfr_set_prec (x, 64); mpfr_set_prec (y, 64); - mpfr_set_str_raw (x, "1.111111111110000000000000000111111111111111111111111110000000001E184"); + mpfr_set_str_binary (x, "1.111111111110000000000000000111111111111111111111111110000000001E184"); mpfr_set_str (y, "0.jo08hg31hc5mmpj5mjjmgn55p2h35g@39", 27, GMP_RNDU); /* y = 49027884868983130654865109690613178467841148597221480052 */ if (mpfr_cmp (x, y)) @@ -302,7 +302,7 @@ main (int argc, char *argv[]) I have increase err by 1 */ mpfr_set_prec (x, 64); /* it was round down instead of up */ mpfr_set_prec (y, 64); - mpfr_set_str_raw (x, "1.111111111111111111111111111000000000000000000000000000000000001e195"); + mpfr_set_str_binary (x, "1.111111111111111111111111111000000000000000000000000000000000001e195"); mpfr_set_str (y, "0.6e23ekb6acgh96abk10b6c9f2ka16i@45", 21, GMP_RNDU); /* y = 100433627392042473064661483711179345482301462325708736552078 */ if (mpfr_cmp (x, y)) @@ -321,7 +321,7 @@ main (int argc, char *argv[]) with more precision : 1.111111100000001111110000000000011111011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110111101010001110111011000010111001011100110110e180 */ mpfr_set_prec (x, 64); /* it was round down instead of up */ mpfr_set_prec (y, 64); - mpfr_set_str_raw (x, "1.111111100000001111110000000000011111011111111111111111111111111e180"); + mpfr_set_str_binary (x, "1.111111100000001111110000000000011111011111111111111111111111111e180"); mpfr_set_str (y, "0.10j8j2k82ehahha56390df0a1de030@41", 23, GMP_RNDZ); /* y = 3053110535624388280648330929253842828159081875986159414 */ if (mpfr_cmp (x, y)) @@ -340,7 +340,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 64); mpfr_set_str (y, "0.jrchfhpp9en7hidqm9bmcofid9q3jg@39", 28, GMP_RNDU); /* y = 196159429139499688661464718784226062699788036696626429952 */ - mpfr_set_str_raw (x, "0.1111111111111111111111111111111000000000000011100000001111100001E187"); + mpfr_set_str_binary (x, "0.1111111111111111111111111111111000000000000011100000001111100001E187"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (6):\n"); @@ -357,7 +357,7 @@ main (int argc, char *argv[]) mpfr_set_prec (y, 64); mpfr_set_str (y, "0.h148m5ld5cf8gk1kd70b6ege92g6ba@47", 24, GMP_RNDZ); /* y = 52652933527468502324759448399183654588831274530295083078827114496 */ - mpfr_set_str_raw (x, "0.1111111111111100000000001000000000000000000011111111111111101111E215"); + mpfr_set_str_binary (x, "0.1111111111111100000000001000000000000000000011111111111111101111E215"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_str (7):\n"); diff --git a/tests/tset_z.c b/tests/tset_z.c index 81ef5ffe0..3ca5139bc 100644 --- a/tests/tset_z.c +++ b/tests/tset_z.c @@ -24,7 +24,9 @@ MA 02111-1307, USA. */ #include <limits.h> #include <time.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" @@ -63,7 +65,7 @@ check_large (void) mpfr_init2 (y, 160); mpz_set_str (z, "77031627725494291259359895954016675357279104942148788042", 10); mpfr_set_z (x, z, GMP_RNDN); - mpfr_set_str_raw (y, "0.1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001001E186"); + mpfr_set_str_binary (y, "0.1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001001E186"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_set_z on large input\n"); diff --git a/tests/tsinh.c b/tests/tsinh.c index 5aae5d645..0fccfae23 100644 --- a/tests/tsinh.c +++ b/tests/tsinh.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_sinh diff --git a/tests/tsqrt.c b/tests/tsqrt.c index 76f067193..31354d09b 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -158,7 +158,7 @@ special (void) mpfr_init (z); mpfr_set_prec (x, 27); - mpfr_set_str_raw (x, "0.110100111010101000010001011"); + mpfr_set_str_binary (x, "0.110100111010101000010001011"); if ((inexact = mpfr_sqrt (x, x, GMP_RNDZ)) >= 0) { printf ("Wrong inexact flag: expected -1, got %d\n", inexact); @@ -183,7 +183,7 @@ special (void) /* check inexact flag */ mpfr_set_prec (x, 5); - mpfr_set_str_raw (x, "1.1001E-2"); + mpfr_set_str_binary (x, "1.1001E-2"); if ((inexact = mpfr_sqrt (x, x, GMP_RNDN))) { printf ("Wrong inexact flag: expected 0, got %d\n", inexact); @@ -206,7 +206,7 @@ special (void) mpfr_set_prec (x, 192); mpfr_set_prec (z, 160); - mpfr_set_str_raw (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1"); + mpfr_set_str_binary (z, "0.1011010100000100100100100110011001011100100100000011000111011001011101101101110000110100001000100001100001011000E1"); mpfr_set_prec (x, 160); mpfr_sqrt(x, z, GMP_RNDN); mpfr_sqrt(z, x, GMP_RNDN); diff --git a/tests/tsub.c b/tests/tsub.c index 9e8e9891b..d3624662e 100644 --- a/tests/tsub.c +++ b/tests/tsub.c @@ -40,10 +40,10 @@ check_diverse (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 63); mpfr_set_prec (z, 63); - mpfr_set_str_raw (x, "0.101101111011011100100100100111E31"); - mpfr_set_str_raw (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1"); + mpfr_set_str_binary (x, "0.101101111011011100100100100111E31"); + mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1"); mpfr_sub (z, x, y, GMP_RNDN); - mpfr_set_str_raw (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); + mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (5)\n"); @@ -54,9 +54,9 @@ check_diverse (void) mpfr_set_prec (y, 63); mpfr_set_prec (z, 63); - mpfr_set_str_raw (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); + mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); mpfr_sub_ui (z, y, 1541116494, GMP_RNDN); - mpfr_set_str_raw (y, "-0.11111001001010010011010110101E-1"); + mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1"); if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (7)\n"); @@ -67,9 +67,9 @@ check_diverse (void) mpfr_set_prec (y, 63); mpfr_set_prec (z, 63); - mpfr_set_str_raw (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); + mpfr_set_str_binary (y, "0.1011011110110111001001001001101100000110110101101100101001011E31"); mpfr_sub_ui (z, y, 1541116494, GMP_RNDN); - mpfr_set_str_raw (y, "-0.11111001001010010011010110101E-1"); + mpfr_set_str_binary (y, "-0.11111001001010010011010110101E-1"); if (mpfr_cmp (z, y)) { printf ("Error in mpfr_sub (6)\n"); @@ -80,8 +80,8 @@ check_diverse (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); - mpfr_set_str_raw (x, "0.10110111101001110100100101111000E0"); - mpfr_set_str_raw (y, "0.10001100100101000100110111000100E0"); + mpfr_set_str_binary (x, "0.10110111101001110100100101111000E0"); + mpfr_set_str_binary (y, "0.10001100100101000100110111000100E0"); if ((inexact = mpfr_sub (x, x, y, GMP_RNDN))) { printf ("Wrong inexact flag (2): got %d instead of 0\n", inexact); @@ -90,8 +90,8 @@ check_diverse (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); - mpfr_set_str_raw (x, "0.11111000110111011000100111011010E0"); - mpfr_set_str_raw (y, "0.10011111101111000100001000000000E-3"); + mpfr_set_str_binary (x, "0.11111000110111011000100111011010E0"); + mpfr_set_str_binary (y, "0.10011111101111000100001000000000E-3"); if ((inexact = mpfr_sub (x, x, y, GMP_RNDN))) { printf ("Wrong inexact flag (1): got %d instead of 0\n", inexact); @@ -101,9 +101,9 @@ check_diverse (void) mpfr_set_prec (x, 33); mpfr_set_prec (y, 33); mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_str_raw (y, "-0.1E-32"); + mpfr_set_str_binary (y, "-0.1E-32"); mpfr_add (x, x, y, GMP_RNDN); - mpfr_set_str_raw (y, "0.111111111111111111111111111111111E0"); + mpfr_set_str_binary (y, "0.111111111111111111111111111111111E0"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_sub (1 - 1E-33) with prec=33\n"); @@ -115,7 +115,7 @@ check_diverse (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 33); mpfr_set_ui (x, 1, GMP_RNDN); - mpfr_set_str_raw (y, "-0.1E-32"); + mpfr_set_str_binary (y, "-0.1E-32"); mpfr_add (x, x, y, GMP_RNDN); if (mpfr_cmp_ui (x, 1)) { @@ -127,8 +127,8 @@ check_diverse (void) mpfr_set_prec (x, 65); mpfr_set_prec (y, 65); mpfr_set_prec (z, 64); - mpfr_set_str_raw (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); - mpfr_set_str_raw (y, "0.1110111011110001110111011111111111101000011001011100101100101100"); + mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); + mpfr_set_str_binary (y, "0.1110111011110001110111011111111111101000011001011100101100101100"); mpfr_sub (z, x, y, GMP_RNDZ); if (mpfr_cmp_ui (z, 1)) { @@ -136,13 +136,13 @@ check_diverse (void) exit (1); } mpfr_sub (z, x, y, GMP_RNDU); - mpfr_set_str_raw (x, "1.000000000000000000000000000000000000000000000000000000000000001"); + mpfr_set_str_binary (x, "1.000000000000000000000000000000000000000000000000000000000000001"); if (mpfr_cmp (z, x)) { printf ("Error in mpfr_sub (2)\n"); exit (1); } - mpfr_set_str_raw (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); + mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101"); mpfr_sub (z, x, y, GMP_RNDN); if (mpfr_cmp_ui (z, 1)) { @@ -150,7 +150,7 @@ check_diverse (void) exit (1); } mpfr_set_prec (x, 66); - mpfr_set_str_raw (x, "1.11101110111100011101110111111111111010000110010111001011001010111"); + mpfr_set_str_binary (x, "1.11101110111100011101110111111111111010000110010111001011001010111"); mpfr_sub (z, x, y, GMP_RNDN); if (mpfr_cmp_ui (z, 1)) { @@ -185,8 +185,8 @@ check_diverse (void) mpfr_set_prec (x, 112); mpfr_set_prec (y, 98); mpfr_set_prec (z, 54); - mpfr_set_str_raw (x, "0.11111100100000000011000011100000101101010001000111E-401"); - mpfr_set_str_raw (y, "0.10110000100100000101101100011111111011101000111000101E-464"); + mpfr_set_str_binary (x, "0.11111100100000000011000011100000101101010001000111E-401"); + mpfr_set_str_binary (y, "0.10110000100100000101101100011111111011101000111000101E-464"); mpfr_sub (z, x, y, GMP_RNDN); if (mpfr_cmp (z, x)) { printf ("mpfr_sub(z, x, y) failed for prec(x)=112, prec(y)=98\n"); @@ -202,10 +202,10 @@ check_diverse (void) mpfr_set_prec (x, 5); mpfr_set_prec (y, 5); - mpfr_set_str_raw (x, "1e-12"); + mpfr_set_str_binary (x, "1e-12"); mpfr_set_ui (y, 1, GMP_RNDN); mpfr_sub (x, y, x, GMP_RNDD); - mpfr_set_str_raw (y, "0.11111"); + mpfr_set_str_binary (y, "0.11111"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_sub (x, y, x, GMP_RNDD) for x=2^(-12), y=1\n"); @@ -214,10 +214,10 @@ check_diverse (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); - mpfr_set_str_raw (x, "-0.100010000000000000000000E19"); - mpfr_set_str_raw (y, "0.100000000000000000000100E15"); + mpfr_set_str_binary (x, "-0.100010000000000000000000E19"); + mpfr_set_str_binary (y, "0.100000000000000000000100E15"); mpfr_add (x, x, y, GMP_RNDD); - mpfr_set_str_raw (y, "-0.1E19"); + mpfr_set_str_binary (y, "-0.1E19"); if (mpfr_cmp (x, y)) { printf ("Error in mpfr_add (2)\n"); @@ -228,7 +228,7 @@ check_diverse (void) mpfr_set_prec (y, 10); mpfr_set_prec (z, 10); mpfr_set_ui (y, 0, GMP_RNDN); - mpfr_set_str_raw (z, "0.100000000000000000000100E15"); + mpfr_set_str_binary (z, "0.100000000000000000000100E15"); if (mpfr_sub (x, y, z, GMP_RNDN) <= 0) { printf ("Wrong inexact flag in x=mpfr_sub(0,z) for prec(z)>prec(x)\n"); diff --git a/tests/ttanh.c b/tests/ttanh.c index 5d3bd173c..f27a970f9 100644 --- a/tests/ttanh.c +++ b/tests/ttanh.c @@ -1,6 +1,6 @@ /* Test file for mpfr_tanh. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2003 Free Software Foundation. Adapted from tarctan.c. This file is part of the MPFR Library. @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define TEST_FUNCTION mpfr_tanh diff --git a/tests/tui_pow.c b/tests/tui_pow.c index e9df640cc..12537a1b5 100644 --- a/tests/tui_pow.c +++ b/tests/tui_pow.c @@ -36,7 +36,7 @@ test1 (void) mpfr_init2 (x, 32); mpfr_init2 (y, 65); - mpfr_set_str_raw (x, "-0.101110001001011011011e-9"); + mpfr_set_str_binary (x, "-0.101110001001011011011e-9"); mpfr_ui_pow (y, 7, x, GMP_RNDN); mpfr_clear (x); mpfr_clear (y); @@ -162,7 +162,7 @@ main (int argc, char *argv[]) mpfr_init2 (t, 6); /* check exact power */ - mpfr_set_str_raw (t, "0.110000E5"); + mpfr_set_str_binary (t, "0.110000E5"); mpfr_ui_pow (z, 3, t, GMP_RNDN); mpfr_clear (z); diff --git a/tests/tui_sub.c b/tests/tui_sub.c index 26ba62bb4..97ab92556 100644 --- a/tests/tui_sub.c +++ b/tests/tui_sub.c @@ -41,7 +41,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); - mpfr_set_str_raw (y, "0.111100110001011010111"); + mpfr_set_str_binary (y, "0.111100110001011010111"); inexact = mpfr_ui_sub (x, 1, y, GMP_RNDN); if (inexact) { @@ -51,7 +51,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); - mpfr_set_str_raw (y, "0.111100110001011010111"); + mpfr_set_str_binary (y, "0.111100110001011010111"); if ((inexact = mpfr_ui_sub (x, 38181761, y, GMP_RNDN)) >= 0) { printf ("Wrong inexact flag: got %d, expected -1\n", inexact); @@ -60,7 +60,7 @@ special (void) mpfr_set_prec (x, 63); mpfr_set_prec (y, 63); - mpfr_set_str_raw (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1"); + mpfr_set_str_binary (y, "0.111110010010100100110101101010001001100101110001000101110111111E-1"); if ((inexact = mpfr_ui_sub (x, 1541116494, y, GMP_RNDN)) <= 0) { printf ("Wrong inexact flag: got %d, expected +1\n", inexact); @@ -69,7 +69,7 @@ special (void) mpfr_set_prec (x, 32); mpfr_set_prec (y, 32); - mpfr_set_str_raw (y, "0.11011000110111010001011100011100E-1"); + mpfr_set_str_binary (y, "0.11011000110111010001011100011100E-1"); if ((inexact = mpfr_ui_sub (x, 2000375416, y, GMP_RNDN)) >= 0) { printf ("Wrong inexact flag: got %d, expected -1\n", inexact); @@ -78,7 +78,7 @@ special (void) mpfr_set_prec (x, 24); mpfr_set_prec (y, 24); - mpfr_set_str_raw (y, "0.110011011001010011110111E-2"); + mpfr_set_str_binary (y, "0.110011011001010011110111E-2"); if ((inexact = mpfr_ui_sub (x, 927694848, y, GMP_RNDN)) <= 0) { printf ("Wrong inexact flag: got %d, expected +1\n", inexact); @@ -89,10 +89,10 @@ special (void) mpfr_set_prec (x, 5); mpfr_set_prec (y, 5); mpfr_set_prec (res, 5); - mpfr_set_str_raw (x, "1e-12"); + mpfr_set_str_binary (x, "1e-12"); mpfr_ui_sub (y, 1, x, GMP_RNDD); - mpfr_set_str_raw (res, "0.11111"); + mpfr_set_str_binary (res, "0.11111"); if (mpfr_cmp (y, res)) { printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDD) for x=2^(-12)\nexpected 1.1111e-1, got "); @@ -102,7 +102,7 @@ special (void) } mpfr_ui_sub (y, 1, x, GMP_RNDU); - mpfr_set_str_raw (res, "1.0"); + mpfr_set_str_binary (res, "1.0"); if (mpfr_cmp (y, res)) { printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDU) for x=2^(-12)\n" @@ -113,7 +113,7 @@ special (void) } mpfr_ui_sub (y, 1, x, GMP_RNDN); - mpfr_set_str_raw (res, "1.0"); + mpfr_set_str_binary (res, "1.0"); if (mpfr_cmp (y, res)) { printf ("Error in mpfr_ui_sub (y, 1, x, GMP_RNDN) for x=2^(-12)\n" diff --git a/tests/tzeta.c b/tests/tzeta.c index 2ca6793c6..7be39805b 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -23,7 +23,9 @@ MA 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include "gmp.h" +#include "gmp-impl.h" #include "mpfr.h" +#include "mpfr-impl.h" #include "mpfr-test.h" #define PREC_MAX 80 @@ -36,7 +38,7 @@ test1 (void) mpfr_init2 (x, 32); mpfr_init2 (y, 42); - mpfr_set_str_raw (x, "1.1111111101000111011010010010100e-1"); + mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1"); mpfr_zeta (y, x, GMP_RNDN); /* shouldn't crash */ mpfr_clear (x); mpfr_clear (y); @@ -148,7 +150,7 @@ main (int argc, char *argv[]) /* the following seems to loop */ mpfr_set_prec (s, 6); mpfr_set_prec (z, 6); - mpfr_set_str_raw (s, "1.10010e4"); + mpfr_set_str_binary (s, "1.10010e4"); mpfr_zeta (z, s, GMP_RNDZ); @@ -164,8 +166,8 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str_raw (s, "0.1100011101110111111111111010000110010111001011001011"); - mpfr_set_str_raw (y, "-0.11111101111011001001001111111000101010000100000100100E2"); + mpfr_set_str_binary (s, "0.1100011101110111111111111010000110010111001011001011"); + mpfr_set_str_binary (y, "-0.11111101111011001001001111111000101010000100000100100E2"); mpfr_zeta (z, s, GMP_RNDN); if (mpfr_cmp (z, y) != 0) { @@ -192,8 +194,8 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str_raw (s, "0.10001011010011100110010001100100001011000010011001011"); - mpfr_set_str_raw (y, "-0.11010011010010101101110111011010011101111101111010110E1"); + mpfr_set_str_binary (s, "0.10001011010011100110010001100100001011000010011001011"); + mpfr_set_str_binary (y, "-0.11010011010010101101110111011010011101111101111010110E1"); mpfr_zeta (z, s, GMP_RNDN); if (mpfr_cmp (z, y) != 0) { @@ -220,8 +222,8 @@ main (int argc, char *argv[]) exit (1); } - mpfr_set_str_raw (s, "0.1100111110100001111110111000110101111001011101000101"); - mpfr_set_str_raw (y, "-0.10010111010110000111011111001101100001111011000001010E3"); + mpfr_set_str_binary (s, "0.1100111110100001111110111000110101111001011101000101"); + mpfr_set_str_binary (y, "-0.10010111010110000111011111001101100001111011000001010E3"); mpfr_zeta (z, s, GMP_RNDN); if (mpfr_cmp (z, y) != 0) { |