diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-05-24 16:31:18 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-05-24 16:31:18 +0000 |
commit | 20b8b7d5e63372e99ccb4e1aefdb720bf98d81a3 (patch) | |
tree | 4962ab418beafc9e3fed8f9a22b39f3dc269832b /set_prc_raw.c | |
parent | 06f11f1365d4115d99a2d68a46082cbbd1a40eb8 (diff) | |
download | mpfr-20b8b7d5e63372e99ccb4e1aefdb720bf98d81a3.tar.gz |
now makes an error when precision too large wrt allocated space
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@541 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_prc_raw.c')
-rw-r--r-- | set_prc_raw.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/set_prc_raw.c b/set_prc_raw.c index 9d6185c67..bda276b88 100644 --- a/set_prc_raw.c +++ b/set_prc_raw.c @@ -1,6 +1,6 @@ -/* mpfr_set_prec -- reset the precision of a floating-point number +/* mpfr_set_prec_raw -- reset the precision of a floating-point number -Copyright (C) 1999 PolKA project, Inria Lorraine and Loria +Copyright (C) 2000 PolKA project, Inria Lorraine and Loria This file is part of the MPFR Library. @@ -34,7 +34,12 @@ mpfr_set_prec_raw (x, p) #endif { if (p==0) { - printf("*** cannot set precision to 0 bits\n"); exit(1); + fprintf(stderr, "*** cannot set precision to 0 bits\n"); exit(1); + } + + if (p > ABSSIZE * BITS_PER_MP_LIMB) { + fprintf(stderr, "*** precision too large for allocated space\n"); + exit(1); } PREC(x) = p; |