1 /* mpfr_inits2 -- initialize several floating-point numbers with given 2 precision 3 4 Copyright 2003-2004, 2006-2023 Free Software Foundation, Inc. 5 Contributed by the AriC and Caramba 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 3 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.LESSER. If not, see 21 https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 22 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ 23 24 #ifdef HAVE_CONFIG_H 25 # include "config.h" 26 #endif 27 28 #if HAVE_STDARG 29 # include <stdarg.h> 30 #else 31 # include <varargs.h> 32 #endif 33 34 #include "mpfr-impl.h" 35 36 /* 37 * Contrary to mpfr_init2, mpfr_prec_t p is the first argument 38 */ 39 40 /* Explicit support for K&R compiler */ 41 void 42 #if HAVE_STDARG 43 mpfr_inits2 (mpfr_prec_t p, mpfr_ptr x, ...) 44 #else 45 mpfr_inits2 (va_alist) 46 va_dcl 47 #endif 48 { 49 va_list arg; 50 #if HAVE_STDARG 51 va_start (arg, x); 52 #else 53 mpfr_prec_t p; 54 mpfr_ptr x; 55 va_start(arg); 56 p = va_arg (arg, mpfr_prec_t); 57 x = va_arg (arg, mpfr_ptr); 58 #endif 59 while (x != 0) 60 { 61 mpfr_init2 (x, p); 62 x = (mpfr_ptr) va_arg (arg, mpfr_ptr); 63 } 64 va_end (arg); 65 } 66