summaryrefslogtreecommitdiff
path: root/setsign.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-08-13 04:53:32 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-08-13 04:53:32 +0000
commitfd7e8c7b1c9fe80b8bd81e3693e982a1d25d3700 (patch)
tree182f8a27390b727aacae5754ade86c03f8da8dd8 /setsign.c
parent29fb331f38a1deaf63f61b17f9c32e2a16b83a60 (diff)
downloadmpfr-fd7e8c7b1c9fe80b8bd81e3693e982a1d25d3700.tar.gz
Implemented changes suggested in
<https://sympa.inria.fr/sympa/arc/mpfr/2007-07/msg00123.html>. * Made mpfr_copysign() like the corresponding function in IEEE 754 (was an internal function until now). * Added mpfr_signbit() and mpfr_setsign(). * Documented these three functions. * Updated TODO. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4759 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'setsign.c')
-rw-r--r--setsign.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/setsign.c b/setsign.c
new file mode 100644
index 000000000..ff099e8f8
--- /dev/null
+++ b/setsign.c
@@ -0,0 +1,30 @@
+/* mpfr_setsign -- Produce a value with the magnitude of x and sign bit s
+
+Copyright 2007 Free Software Foundation, Inc.
+Contributed by the Arenaire and Cacao projects, INRIA.
+
+This file is part of the MPFR Library.
+
+The MPFR Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or (at your
+option) any later version.
+
+The MPFR Library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with the MPFR Library; see the file COPYING.LIB. If not, write to
+the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA 02110-1301, USA. */
+
+#include "mpfr-impl.h"
+
+#undef mpfr_setsign
+int
+mpfr_setsign (mpfr_ptr z, mpfr_srcptr x, int s, mp_rnd_t rnd_mode)
+{
+ return mpfr_set4 (z, x, rnd_mode, s ? -1 : 1);
+}