diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-15 13:48:15 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-09-15 13:48:15 +0000 |
commit | 663222305413f69aaac6e6e14f35bffb5b42b5fc (patch) | |
tree | 877057d08ce0e8cb69f3c79fd9e856f099b5019e /set_flt.c | |
parent | da8366f99b53bb0e4c33792241b59249aafec9ca (diff) | |
download | mpfr-663222305413f69aaac6e6e14f35bffb5b42b5fc.tar.gz |
changed _binary32 into _flt for file names too:
svn mv get_binary32.c get_flt.c
svn mv set_binary32.c set_flt.c
svn mv tests/tget_binary32.c tests/tget_flt.c
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6442 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_flt.c')
-rw-r--r-- | set_flt.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/set_flt.c b/set_flt.c new file mode 100644 index 000000000..09a26de7a --- /dev/null +++ b/set_flt.c @@ -0,0 +1,34 @@ +/* mpfr_set_flt -- convert a machine single precision float to mpfr_t + +Copyright 2009 Free Software Foundation, Inc. +Contributed by the Arenaire and Cacao projects, INRIA. + +This file is part of the GNU MPFR Library. + +The GNU 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 3 of the License, or (at your +option) any later version. + +The GNU 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 GNU MPFR Library; see the file COPYING.LESSER. If not, see +http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ + +#include "mpfr-impl.h" + +int +mpfr_set_flt (mpfr_ptr r, float f, mpfr_rnd_t rnd_mode) +{ + /* we convert f to double precision and use mpfr_set_d; + NaN and infinities should be preserved, and all single precision + numbers are exactly representable in the double format, thus the + conversion is always exact */ + return mpfr_set_d (r, (double) f, rnd_mode); +} + |