aboutsummaryrefslogtreecommitdiffstats
path: root/mpfr.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpfr.c')
-rw-r--r--mpfr.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/mpfr.c b/mpfr.c
index 829f1f34..c09d2f03 100644
--- a/mpfr.c
+++ b/mpfr.c
@@ -767,6 +767,8 @@ do_mpfr_atan2(int nargs)
mpfr_ptr p1, p2;
int tval;
+ check_exact_args(nargs, "atan2", 2);
+
t2 = POP_SCALAR();
t1 = POP_SCALAR();
@@ -803,6 +805,8 @@ do_mpfr_func(const char *name,
int tval;
mpfr_prec_t argprec;
+ check_exact_args(nargs, name, 1);
+
t1 = POP_SCALAR();
if (do_lint && (fixtype(t1)->flags & NUMBER) == 0)
lintwarn(_("%s: received non-numeric argument"), name);
@@ -874,6 +878,8 @@ do_mpfr_int(int nargs)
{
NODE *tmp, *r;
+ check_exact_args(nargs, "int", 1);
+
tmp = POP_SCALAR();
if (do_lint && (fixtype(tmp)->flags & NUMBER) == 0)
lintwarn(_("int: received non-numeric argument"));
@@ -904,6 +910,8 @@ do_mpfr_compl(int nargs)
NODE *tmp, *r;
mpz_ptr zptr;
+ check_exact_args(nargs, "compl", 1);
+
tmp = POP_SCALAR();
if (do_lint && (fixtype(tmp)->flags & NUMBER) == 0)
lintwarn(_("compl: received non-numeric argument"));
@@ -1023,6 +1031,8 @@ do_mpfr_lshift(int nargs)
unsigned long shift;
mpz_ptr pz1, pz2;
+ check_exact_args(nargs, "lshift", 2);
+
t2 = POP_SCALAR();
t1 = POP_SCALAR();
@@ -1055,6 +1065,8 @@ do_mpfr_rshift(int nargs)
unsigned long shift;
mpz_ptr pz1, pz2;
+ check_exact_args(nargs, "rshift", 2);
+
t2 = POP_SCALAR();
t1 = POP_SCALAR();
@@ -1175,6 +1187,8 @@ do_mpfr_strtonum(int nargs)
{
NODE *tmp, *r;
+ check_exact_args(nargs, "strtonum", 1);
+
tmp = fixtype(POP_SCALAR());
if ((tmp->flags & NUMBER) == 0) {
r = mpg_integer(); /* will be changed to MPFR float if necessary in force_mpnum() */
@@ -1212,6 +1226,8 @@ do_mpfr_rand(int nargs ATTRIBUTE_UNUSED)
NODE *res;
int tval;
+ check_exact_args(nargs, "rand", 0);
+
if (firstrand) {
#if 0
/* Choose the default algorithm */
@@ -1262,6 +1278,8 @@ do_mpfr_srand(int nargs)
firstrand = false;
}
+ check_args_min_max(nargs, "srand", 0, 1);
+
res = mpg_integer();
mpz_set(res->mpg_i, seed); /* previous seed */
@@ -1303,6 +1321,8 @@ do_mpfr_intdiv(int nargs)
NODE *quotient, *remainder;
NODE *sub, **lhs;
+ check_exact_args(nargs, "intdiv", 3);
+
result = POP_PARAM();
if (result->type != Node_var_array)
fatal(_("intdiv: third argument is not an array"));