summaryrefslogtreecommitdiff
path: root/div_ui.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-02-22 10:50:14 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-02-22 10:50:14 +0000
commit7b56ff4f46e5f472effcecd32585cdbcb824eb4c (patch)
tree1f482f18ae7d385e5167e6578ffc785342010f4d /div_ui.c
parentbecd0fe5fdf57a169f4fce56c001f7311ef00a61 (diff)
downloadmpfr-7b56ff4f46e5f472effcecd32585cdbcb824eb4c.tar.gz
Reduce InterObject dependency by moving mul_si, div_si and si_div
to the unique function they used. Improve mul_ui by inlining the rounding. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3346 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'div_ui.c')
-rw-r--r--div_ui.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/div_ui.c b/div_ui.c
index 7c01f35aa..02d2fa383 100644
--- a/div_ui.c
+++ b/div_ui.c
@@ -1,6 +1,8 @@
/* mpfr_div_ui -- divide a floating-point number by a machine integer
+ mpfr_div_si -- divide a floating-point number by a machine integer
-Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005
+ Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -185,3 +187,17 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
}
return 0; /* To avoid warning*/
}
+
+int mpfr_div_si (mpfr_ptr y, mpfr_srcptr x, long int u, mp_rnd_t rnd_mode)
+{
+ int res;
+
+ if (u >= 0)
+ res = mpfr_div_ui (y, x, u, rnd_mode);
+ else
+ {
+ res = -mpfr_div_ui (y, x, -u, MPFR_INVERT_RND (rnd_mode));
+ MPFR_CHANGE_SIGN (y);
+ }
+ return res;
+}