1 /* LibTomFloat, multiple-precision floating-point library
3 * LibTomFloat is a library that provides multiple-precision
4 * floating-point artihmetic as well as trigonometric functionality.
6 * This library requires the public domain LibTomMath to be installed.
8 * This library is free for all purposes without any express
11 * Tom St Denis, tomstdenis@iahu.ca, http://float.libtomcrypt.org
16 int mpf_init_multi(long radix
, mp_float
*a
, ...)
18 mp_err res
= MP_OKAY
; /* Assume ok until proven otherwise */
19 int n
= 0; /* Number of ok inits */
20 mp_float
* cur_arg
= a
;
23 va_start(args
, a
); /* init args to next argument from caller */
24 while (cur_arg
!= NULL
) {
25 if (mpf_init(cur_arg
, radix
) != MP_OKAY
) {
26 /* Oops - error! Back-track and mp_clear what we already
27 succeeded in init-ing, then return error.
31 /* end the current list */
34 /* now start cleaning up */
36 va_start(clean_args
, a
);
39 cur_arg
= va_arg(clean_args
, mp_float
*);
46 cur_arg
= va_arg(args
, mp_float
*);
49 return res
; /* Assumed ok, if error flagged above. */