About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Go to the documentation of this file.
1 /* mpfr_set_prec -- reset the precision of a floating-point number
3 Copyright 1999, 2001-2002, 2004, 2006-2020 Free Software Foundation, Inc.
4 Contributed by the AriC and Caramba projects, INRIA.
6 This file is part of the GNU MPFR Library.
8 The GNU MPFR Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or (at your
11 option) any later version.
13 The GNU MPFR Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see
20 https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
21 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
23 #include "mpfr-impl.h"
27 {
28  mp_size_t xsize, xoldsize;
30  /* first, check if p is correct */
33  /* Calculate the new number of limbs */
36  /* Realloc only if the new size is greater than the old */
37  xoldsize = MPFR_GET_ALLOC_SIZE (x);
38  if (xsize > xoldsize)
39  {
40  mpfr_size_limb_t *tmp;
44  MPFR_MALLOC_SIZE(xoldsize),
46  MPFR_SET_MANT_PTR(x, tmp);
48  }
49  MPFR_PREC (x) = p;
50  MPFR_SET_NAN (x); /* initializes to NaN */
51 }
53 #undef mpfr_get_prec
56 {
57  return MPFR_PREC(x);
58 }
long int mp_size_t
Definition: gmp.h:175
small capitals from c petite p
Definition: afcover.h:72
void * mpfr_reallocate_func(void *ptr, size_t old_size, size_t new_size)
Definition: mpfr-gmp.c:319
#define MPFR_SET_NAN(x)
Definition: mpfr-impl.h:1081
#define MPFR_PREC_COND(p)
Definition: mpfr-impl.h:942
#define MPFR_PREC(x)
Definition: mpfr-impl.h:958
Definition: mpfr-impl.h:192
#define MPFR_SET_ALLOC_SIZE(x, n)
Definition: mpfr-impl.h:1321
Definition: mpfr-impl.h:1323
Definition: mpfr-impl.h:1319
#define MPFR_ASSERTN(expr)
Definition: mpfr-impl.h:495
#define MPFR_PREC2LIMBS(p)
Definition: mpfr-impl.h:955
#define MPFR_GET_REAL_PTR(x)
Definition: mpfr-impl.h:1327
#define MPFR_SET_MANT_PTR(x, p)
Definition: mpfr-impl.h:1325
long mpfr_prec_t
Definition: mpfr.h:168
float x
Definition: cordic.py:15
static int xsize
Definition: ppmtopjxl.c:41
mpfr_prec_t mpfr_get_prec(mpfr_srcptr x)
Definition: set_prec.c:55
void mpfr_set_prec(mpfr_ptr x, mpfr_prec_t p)
Definition: set_prec.c:26