diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-02-22 10:50:14 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2005-02-22 10:50:14 +0000 |
commit | 7b56ff4f46e5f472effcecd32585cdbcb824eb4c (patch) | |
tree | 1f482f18ae7d385e5167e6578ffc785342010f4d /div_ui.c | |
parent | becd0fe5fdf57a169f4fce56c001f7311ef00a61 (diff) | |
download | mpfr-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.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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; +} |