1103026Ssobomax/* mpfr_mul_d -- multiply a multiple precision floating-point number 2103026Ssobomax by a machine double precision float 3103026Ssobomax 4103026SsobomaxCopyright 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. 5103026SsobomaxContributed by the Arenaire and Cacao projects, INRIA. 6103026Ssobomax 7103026SsobomaxThis file is part of the GNU MPFR Library. 8103026Ssobomax 9103026SsobomaxThe GNU MPFR Library is free software; you can redistribute it and/or modify 10103026Ssobomaxit under the terms of the GNU Lesser General Public License as published by 11103026Ssobomaxthe Free Software Foundation; either version 3 of the License, or (at your 12103026Ssobomaxoption) any later version. 13103026Ssobomax 14103026SsobomaxThe GNU MPFR Library is distributed in the hope that it will be useful, but 15103026SsobomaxWITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 16103026Ssobomaxor FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 17103026SsobomaxLicense for more details. 18103026Ssobomax 19103026SsobomaxYou should have received a copy of the GNU Lesser General Public License 20103026Ssobomaxalong with the GNU MPFR Library; see the file COPYING.LESSER. If not, see 21103026Ssobomaxhttp://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 22103026Ssobomax51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ 23103026Ssobomax 24103026Ssobomax#include "mpfr-impl.h" 25103026Ssobomax 26107726Sruint 27107726Srumpfr_mul_d (mpfr_ptr a, mpfr_srcptr b, double c, mpfr_rnd_t rnd_mode) 28103026Ssobomax{ 29103026Ssobomax int inexact; 30107726Sru mpfr_t d; 31107726Sru MPFR_SAVE_EXPO_DECL (expo); 32284075Sae 33103026Ssobomax MPFR_LOG_FUNC (("b[%#R]=%R c=%.20g rnd=%d", b, b, c, rnd_mode), 34103026Ssobomax ("a[%#R]=%R", a, a)); 35103026Ssobomax 36103026Ssobomax MPFR_SAVE_EXPO_MARK (expo); 37103026Ssobomax 38103026Ssobomax mpfr_init2 (d, IEEE_DBL_MANT_DIG); 39163500Sdanger inexact = mpfr_set_d (d, c, rnd_mode); 40235450Sjoel MPFR_ASSERTN (inexact == 0); 41163500Sdanger 42163500Sdanger mpfr_clear_flags (); 43107726Sru inexact = mpfr_mul (a, b, d, rnd_mode); 44163500Sdanger MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags); 45163500Sdanger 46163500Sdanger mpfr_clear(d); 47235450Sjoel MPFR_SAVE_EXPO_FREE (expo); 48163500Sdanger return mpfr_check_range (a, inexact, rnd_mode); 49163500Sdanger} 50163500Sdanger