Add APIC_ID to extract apic id from local apic id field
[dragonfly.git] / contrib / mpfr / mul_d.c
1 /* mpfr_mul_d -- multiply a multiple precision floating-point number
2                  by a machine double precision float
3
4 Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
5 Contributed by the Arenaire and Cacao projects, INRIA.
6
7 This file is part of the GNU MPFR Library.
8
9 The GNU MPFR Library is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or (at your
12 option) any later version.
13
14 The GNU MPFR Library is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17 License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with the GNU MPFR Library; see the file COPYING.LIB.  If not, write to
21 the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 MA 02110-1301, USA. */
23
24 #include "mpfr-impl.h"
25
26 int
27 mpfr_mul_d (mpfr_ptr a, mpfr_srcptr b, double c, mp_rnd_t rnd_mode)
28 {
29   int inexact;
30   mpfr_t d;
31   MPFR_SAVE_EXPO_DECL (expo);
32
33   MPFR_LOG_FUNC (("b[%#R]=%R c=%.20g rnd=%d", b, b, c, rnd_mode),
34                  ("a[%#R]=%R", a, a));
35
36   MPFR_SAVE_EXPO_MARK (expo);
37
38   mpfr_init2 (d, IEEE_DBL_MANT_DIG);
39   inexact = mpfr_set_d (d, c, rnd_mode);
40   MPFR_ASSERTN (inexact == 0);
41
42   mpfr_clear_flags ();
43   inexact = mpfr_mul (a, b, d, rnd_mode);
44   MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
45
46   mpfr_clear(d);
47   MPFR_SAVE_EXPO_FREE (expo);
48   return mpfr_check_range (a, inexact, rnd_mode);
49 }