summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordaney <daney@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-26 12:37:43 +0000
committerdaney <daney@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-26 12:37:43 +0000
commite42e167752a589a7c2ea6d05a97c391eeb374197 (patch)
tree3dc1a34d013320104cf2dd9de5f8cff11bee8e54
parentd703ad9eebdd3222880f444d8d8dccde3775c765 (diff)
downloadmpfr-e42e167752a589a7c2ea6d05a97c391eeb374197.tar.gz
simplify dim
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1419 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--dim.c39
1 files changed, 6 insertions, 33 deletions
diff --git a/dim.c b/dim.c
index ff4ad2e88..c13a75849 100644
--- a/dim.c
+++ b/dim.c
@@ -42,18 +42,6 @@ mpfr_dim (z, x, y, rnd_mode)
mp_rnd_t rnd_mode;
#endif
{
-
- /****** Declaration ******/
-
- /* Variable of Intermediary Calculation*/
- mpfr_t t;
-
- mp_prec_t Nx; /* Precision of input variable */
- mp_prec_t Nz; /* Precision of input variable */
- mp_prec_t Ny; /* Precision of output variable */
- mp_prec_t Nt;
-
- int inexact=0;
if (MPFR_IS_NAN(x) || MPFR_IS_NAN(y) )
{
@@ -62,29 +50,14 @@ mpfr_dim (z, x, y, rnd_mode)
}
MPFR_CLEAR_NAN(z);
- /* Initialisation of the Precision */
- Nx=MPFR_PREC(x);
- Ny=MPFR_PREC(y);
- Nz=MPFR_PREC(z);
-
- /* compute the size of intermediary variable */
- Nt=MAX(Nx,MAX(Ny,Nz));
-
- /* initialise of intermediary variable */
- mpfr_init2(t,Nt);
-
if(mpfr_cmp(x,y) > 0)
- mpfr_sub(t,x,y,GMP_RNDN);
+ return mpfr_sub(z,x,y,rnd_mode);
else
{
- MPFR_SET_ZERO(t);
- if(MPFR_SIGN(t) < 0)
- CHANGE_SIGN(t);
+ MPFR_SET_ZERO(z);
+ if(MPFR_SIGN(z) < 0)
+ MPFR_CHANGE_SIGN(z);
+ return 0;
}
-
- inexact = mpfr_set(z,t,rnd_mode);
-
- mpfr_clear(t);
- return inexact;
-
}
+