Lines Matching full:a

30 the library's routines.  The integer library is just a single source file, so
38 number. The type `mp_int` is a pointer to an `mpz_t`, and `mp_rat` is a
41 Most of the functions in the imath library return a value of type `mp_result`.
42 This is a signed integer type which can be used to convey status information
43 and also return small values. Any negative value is considered to be a status
57 If you obtain a zero or negative value of an `mp_result`, you can use the
58 `mp_error_string()` routine to obtain a pointer to a brief human-readable
65 add a number to itself and replace the original by writing:
67 mp_int_add(a, a, a); /* a = a + a */
70 below (if you discover that this is not so, please report it as a bug; I will
94 | `MP_DIGIT_BIT` | the number of bits in a single `mpz_t` digit.
95 | `MP_WORD_BIT` | the number of bits in a `mpz_t` word.
105 initialized with a certain minimum amount of storage for digits, and the
110 <a id="mp_int_init"></a><pre>
111 mp_result <a href="imath.h#L115">mp_int_init</a>(mp_int z);
117 <a id="mp_int_alloc"></a><pre>
118 mp_int <a href="imath.h#L119">mp_int_alloc</a>(void);
120 - Allocates a fresh zero-valued `mpz_t` on the heap, returning NULL in case
124 <a id="mp_int_init_size"></a><pre>
125 mp_result <a href="imath.h#L124">mp_int_init_size</a>(mp_int z, mp_size prec);
132 <a id="mp_int_init_copy"></a><pre>
133 mp_result <a href="imath.h#L128">mp_int_init_copy</a>(mp_int z, mp_int old);
135 - Initializes `z` to be a copy of an already-initialized value in `old`. The
139 <a id="mp_int_init_value"></a><pre>
140 mp_result <a href="imath.h#L131">mp_int_init_value</a>(mp_int z, mp_small value);
151 <a id="mp_int_clear"></a><pre>
152 void <a href="imath.h#L143">mp_int_clear</a>(mp_int z);
157 <a id="mp_int_free"></a><pre>
158 void <a href="imath.h#L147">mp_int_free</a>(mp_int z);
167 To set an `mp_int` which has already been initialized to a small integer value,
171 <a id="mp_int_set_value"></a><pre>
172 mp_result <a href="imath.h#L137">mp_int_set_value</a>(mp_int z, mp_small value);
177 <a id="mp_int_set_uvalue"></a><pre>
178 mp_result <a href="imath.h#L140">mp_int_set_uvalue</a>(mp_int z, mp_usmall uvalue);
187 <a id="mp_int_copy"></a><pre>
188 mp_result <a href="imath.h#L151">mp_int_copy</a>(mp_int a, mp_int c);
190 - Replaces the value of `c` with a copy of the value of `a`. No new memory is
191 allocated unless `a` has more significant digits than `c` has allocated.
198 <a id="mp_int_is_odd"></a><pre>
199 static inline bool <a href="imath.h#L108">mp_int_is_odd</a>(mp_int z);
204 <a id="mp_int_is_even"></a><pre>
205 static inline bool <a href="imath.h#L111">mp_int_is_even</a>(mp_int z);
210 <a id="mp_int_zero"></a><pre>
211 void <a href="imath.h#L157">mp_int_zero</a>(mp_int z);
216 <a id="mp_int_abs"></a><pre>
217 mp_result <a href="imath.h#L160">mp_int_abs</a>(mp_int a, mp_int c);
219 - Sets `c` to the absolute value of `a`.
222 <a id="mp_int_neg"></a><pre>
223 mp_result <a href="imath.h#L163">mp_int_neg</a>(mp_int a, mp_int c);
225 - Sets `c` to the additive inverse (negation) of `a`.
228 <a id="mp_int_add"></a><pre>
229 mp_result <a href="imath.h#L166">mp_int_add</a>(mp_int a, mp_int b, mp_int c);
231 - Sets `c` to the sum of `a` and `b`.
234 <a id="mp_int_add_value"></a><pre>
235 mp_result <a href="imath.h#L169">mp_int_add_value</a>(mp_int a, mp_small value, mp_int c);
237 - Sets `c` to the sum of `a` and `value`.
240 <a id="mp_int_sub"></a><pre>
241 mp_result <a href="imath.h#L172">mp_int_sub</a>(mp_int a, mp_int b, mp_int c);
243 - Sets `c` to the difference of `a` less `b`.
246 <a id="mp_int_sub_value"></a><pre>
247 mp_result <a href="imath.h#L175">mp_int_sub_value</a>(mp_int a, mp_small value, mp_int c);
249 - Sets `c` to the difference of `a` less `value`.
252 <a id="mp_int_mul"></a><pre>
253 mp_result <a href="imath.h#L178">mp_int_mul</a>(mp_int a, mp_int b, mp_int c);
255 - Sets `c` to the product of `a` and `b`.
258 <a id="mp_int_mul_value"></a><pre>
259 mp_result <a href="imath.h#L181">mp_int_mul_value</a>(mp_int a, mp_small value, mp_int c);
261 - Sets `c` to the product of `a` and `value`.
264 <a id="mp_int_mul_pow2"></a><pre>
265 mp_result <a href="imath.h#L184">mp_int_mul_pow2</a>(mp_int a, mp_small p2, mp_int c);
267 - Sets `c` to the product of `a` and `2^p2`. Requires `p2 >= 0`.
270 <a id="mp_int_sqr"></a><pre>
271 mp_result <a href="imath.h#L187">mp_int_sqr</a>(mp_int a, mp_int c);
273 - Sets `c` to the square of `a`.
276 <a id="mp_int_root"></a><pre>
277 mp_result <a href="imath.h#L306">mp_int_root</a>(mp_int a, mp_small b, mp_int c);
279 - Sets `c` to the greatest integer not less than the `b`th root of `a`,
281 It returns `MP_UNDEF` if `a < 0` and `b` is even.
284 <a id="mp_int_sqrt"></a><pre>
285 static inline mp_result <a href="imath.h#L310">mp_int_sqrt</a>(mp_int a, mp_int c);
287 - Sets `c` to the greatest integer not less than the square root of `a`.
288 This is a special case of `mp_int_root()`.
291 <a id="mp_int_div"></a><pre>
292 mp_result <a href="imath.h#L195">mp_int_div</a>(mp_int a, mp_int b, mp_int q, mp_int r);
294 - Sets `q` and `r` to the quotent and remainder of `a / b`. Division by
302 <a id="mp_int_div_value"></a><pre>
303 mp_result <a href="imath.h#L200">mp_int_div_value</a>(mp_int a, mp_small value, mp_int q, mp_small …
305 - Sets `q` and `*r` to the quotent and remainder of `a / value`. Division by
310 <a id="mp_int_div_pow2"></a><pre>
311 mp_result <a href="imath.h#L206">mp_int_div_pow2</a>(mp_int a, mp_small p2, mp_int q, mp_int r);
313 - Sets `q` and `r` to the quotient and remainder of `a / 2^p2`. This is a
319 <a id="mp_int_mod"></a><pre>
320 mp_result <a href="imath.h#L210">mp_int_mod</a>(mp_int a, mp_int m, mp_int c);
322 - Sets `c` to the remainder of `a / m`.
326 <a id="mp_int_mod_value"></a><pre>
327 static inline mp_result <a href="imath.h#L226">mp_int_mod_value</a>(mp_int a, mp_small value, mp_sm…
329 - Sets `*r` to the remainder of `a / value`.
333 <a id="mp_int_expt"></a><pre>
334 mp_result <a href="imath.h#L214">mp_int_expt</a>(mp_int a, mp_small b, mp_int c);
336 - Sets `c` to the value of `a` raised to the `b` power.
340 <a id="mp_int_expt_value"></a><pre>
341 mp_result <a href="imath.h#L218">mp_int_expt_value</a>(mp_small a, mp_small b, mp_int c);
343 - Sets `c` to the value of `a` raised to the `b` power.
347 <a id="mp_int_expt_full"></a><pre>
348 mp_result <a href="imath.h#L222">mp_int_expt_full</a>(mp_int a, mp_int b, mp_int c);
350 - Sets `c` to the value of `a` raised to the `b` power.
357 Unless otherwise specified, comparison between values `x` and `y` returns a
362 <a id="mp_int_compare"></a><pre>
363 int <a href="imath.h#L232">mp_int_compare</a>(mp_int a, mp_int b);
365 - Returns the comparator of `a` and `b`.
368 <a id="mp_int_compare_unsigned"></a><pre>
369 int <a href="imath.h#L236">mp_int_compare_unsigned</a>(mp_int a, mp_int b);
371 - Returns the comparator of the magnitudes of `a` and `b`, disregarding their
372 signs. Neither `a` nor `b` is modified by the comparison.
375 <a id="mp_int_compare_zero"></a><pre>
376 int <a href="imath.h#L239">mp_int_compare_zero</a>(mp_int z);
381 <a id="mp_int_compare_value"></a><pre>
382 int <a href="imath.h#L242">mp_int_compare_value</a>(mp_int z, mp_small v);
387 <a id="mp_int_compare_uvalue"></a><pre>
388 int <a href="imath.h#L245">mp_int_compare_uvalue</a>(mp_int z, mp_usmall uv);
393 <a id="mp_int_divisible_value"></a><pre>
394 bool <a href="imath.h#L248">mp_int_divisible_value</a>(mp_int a, mp_small v);
396 - Reports whether `a` is divisible by `v`.
399 <a id="mp_int_is_pow2"></a><pre>
400 int <a href="imath.h#L252">mp_int_is_pow2</a>(mp_int z);
402 - Returns `k >= 0` such that `z` is `2^k`, if such a `k` exists. If no such
410 <a id="mp_int_exptmod"></a><pre>
411 mp_result <a href="imath.h#L256">mp_int_exptmod</a>(mp_int a, mp_int b, mp_int m, mp_int c);
413 - Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`.
417 <a id="mp_int_exptmod_evalue"></a><pre>
418 mp_result <a href="imath.h#L260">mp_int_exptmod_evalue</a>(mp_int a, mp_small value, mp_int m, mp_i…
420 - Sets `c` to the value of `a` raised to the `value` power, modulo `m`.
424 <a id="mp_int_exptmod_bvalue"></a><pre>
425 mp_result <a href="imath.h#L264">mp_int_exptmod_bvalue</a>(mp_small value, mp_int b, mp_int m, mp_i…
431 <a id="mp_int_exptmod_known"></a><pre>
432 mp_result <a href="imath.h#L271">mp_int_exptmod_known</a>(mp_int a, mp_int b, mp_int m, mp_int mu, …
434 - Sets `c` to the value of `a` raised to the `b` power, reduced modulo `m`,
435 given a precomputed reduction constant `mu` defined for Barrett's modular
441 <a id="mp_int_redux_const"></a><pre>
442 mp_result <a href="imath.h#L275">mp_int_redux_const</a>(mp_int m, mp_int c);
448 <a id="mp_int_invmod"></a><pre>
449 mp_result <a href="imath.h#L282">mp_int_invmod</a>(mp_int a, mp_int m, mp_int c);
451 - Sets `c` to the multiplicative inverse of `a` modulo `m`, if it exists.
454 It returns `MP_UNDEF` if the inverse does not exist, or `MP_RANGE` if `a ==
458 <a id="mp_int_gcd"></a><pre>
459 mp_result <a href="imath.h#L288">mp_int_gcd</a>(mp_int a, mp_int b, mp_int c);
461 - Sets `c` to the greatest common divisor of `a` and `b`.
463 It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`
467 <a id="mp_int_egcd"></a><pre>
468 mp_result <a href="imath.h#L295">mp_int_egcd</a>(mp_int a, mp_int b, mp_int c, mp_int x, mp_int y);
470 - Sets `c` to the greatest common divisor of `a` and `b`, and sets `x` and
471 `y` to values satisfying Bezout's identity `gcd(a, b) = ax + by`.
473 It returns `MP_UNDEF` if the GCD is undefined, such as for example if `a`
477 <a id="mp_int_lcm"></a><pre>
478 mp_result <a href="imath.h#L301">mp_int_lcm</a>(mp_int a, mp_int b, mp_int c);
480 - Sets `c` to the least common multiple of `a` and `b`.
482 It returns `MP_UNDEF` if the LCM is undefined, such as for example if `a`
490 <a id="mp_int_to_int"></a><pre>
491 mp_result <a href="imath.h#L315">mp_int_to_int</a>(mp_int z, mp_small *out);
497 <a id="mp_int_to_uint"></a><pre>
498 mp_result <a href="imath.h#L319">mp_int_to_uint</a>(mp_int z, mp_usmall *out);
504 <a id="mp_int_to_string"></a><pre>
505 mp_result <a href="imath.h#L327">mp_int_to_string</a>(mp_int z, mp_size radix, char *str, int limit…
507 - Converts `z` to a zero-terminated string of characters in the specified
509 terminating NUL value. A leading `-` is used to indicate a negative value.
515 <a id="mp_int_string_len"></a><pre>
516 mp_result <a href="imath.h#L332">mp_int_string_len</a>(mp_int z, mp_size radix);
518 - Reports the minimum number of characters required to represent `z` as a
523 <a id="mp_int_read_string"></a><pre>
524 mp_result <a href="imath.h#L347">mp_int_read_string</a>(mp_int z, mp_size radix, const char *str);
526 - Reads a string of ASCII digits in the specified `radix` from the zero
528 `A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect
531 Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a
532 sign flag. Processing stops when a NUL or any other character out of range
533 for a digit in the given radix is encountered.
541 <a id="mp_int_read_cstring"></a><pre>
542 mp_result <a href="imath.h#L365">mp_int_read_cstring</a>(mp_int z, mp_size radix, const char *str, …
544 - Reads a string of ASCII digits in the specified `radix` from the zero
546 `A`..`Z` or `a`..`z` are accepted. Letters are interpreted without respect
549 Leading whitespace is ignored, and a leading `+` or `-` is interpreted as a
550 sign flag. Processing stops when a NUL or any other character out of range
551 for a digit in the given radix is encountered.
562 <a id="mp_int_count_bits"></a><pre>
563 mp_result <a href="imath.h#L368">mp_int_count_bits</a>(mp_int z);
568 <a id="mp_int_to_binary"></a><pre>
569 mp_result <a href="imath.h#L383">mp_int_to_binary</a>(mp_int z, unsigned char *buf, int limit);
581 As a result, non-negative values will be padded with a leading zero byte if
586 <a id="mp_int_read_binary"></a><pre>
587 mp_result <a href="imath.h#L388">mp_int_read_binary</a>(mp_int z, unsigned char *buf, int len);
589 - Reads a 2's complement binary value from `buf` into `z`, where `len` is the
594 <a id="mp_int_binary_len"></a><pre>
595 mp_result <a href="imath.h#L391">mp_int_binary_len</a>(mp_int z);
600 <a id="mp_int_to_unsigned"></a><pre>
601 mp_result <a href="imath.h#L402">mp_int_to_unsigned</a>(mp_int z, unsigned char *buf, int limit);
614 <a id="mp_int_read_unsigned"></a><pre>
615 mp_result <a href="imath.h#L407">mp_int_read_unsigned</a>(mp_int z, unsigned char *buf, int len);
622 <a id="mp_int_unsigned_len"></a><pre>
623 mp_result <a href="imath.h#L411">mp_int_unsigned_len</a>(mp_int z);
634 there is a more efficient algorithm usually attributed to Karatsuba and Ofman
639 by a static digit threshold defined in `imath.c`. Values with fewer significant
642 `findthreshold.py` script (Python) can help you find a suitable value for for
646 <a id="mp_error_string"></a><pre>
647 const char *<a href="imath.h#L416">mp_error_string</a>(mp_result res);
649 - Returns a pointer to a brief, human-readable, zero-terminated string
658 <a id="mp_rat_init"></a><pre>
659 mp_result <a href="imrat.h#L59">mp_rat_init</a>(mp_rat r);
665 <a id="mp_rat_alloc"></a><pre>
666 mp_rat <a href="imrat.h#L63">mp_rat_alloc</a>(void);
668 - Allocates a fresh zero-valued `mpq_t` on the heap, returning NULL in case
672 <a id="mp_rat_reduce"></a><pre>
673 mp_result <a href="imrat.h#L69">mp_rat_reduce</a>(mp_rat r);
681 <a id="mp_rat_init_size"></a><pre>
682 mp_result <a href="imrat.h#L76">mp_rat_init_size</a>(mp_rat r, mp_size n_prec, mp_size d_prec);
691 <a id="mp_rat_init_copy"></a><pre>
692 mp_result <a href="imrat.h#L80">mp_rat_init_copy</a>(mp_rat r, mp_rat old);
694 - Initializes `r` to be a copy of an already-initialized value in `old`. The
698 <a id="mp_rat_set_value"></a><pre>
699 mp_result <a href="imrat.h#L84">mp_rat_set_value</a>(mp_rat r, mp_small numer, mp_small denom);
705 <a id="mp_rat_set_uvalue"></a><pre>
706 mp_result <a href="imrat.h#L88">mp_rat_set_uvalue</a>(mp_rat r, mp_usmall numer, mp_usmall denom);
712 <a id="mp_rat_clear"></a><pre>
713 void <a href="imrat.h#L91">mp_rat_clear</a>(mp_rat r);
718 <a id="mp_rat_free"></a><pre>
719 void <a href="imrat.h#L95">mp_rat_free</a>(mp_rat r);
725 <a id="mp_rat_numer"></a><pre>
726 mp_result <a href="imrat.h#L98">mp_rat_numer</a>(mp_rat r, mp_int z);
728 - Sets `z` to a copy of the numerator of `r`.
731 <a id="mp_rat_numer_ref"></a><pre>
732 mp_int <a href="imrat.h#L101">mp_rat_numer_ref</a>(mp_rat r);
734 - Returns a pointer to the numerator of `r`.
737 <a id="mp_rat_denom"></a><pre>
738 mp_result <a href="imrat.h#L104">mp_rat_denom</a>(mp_rat r, mp_int z);
740 - Sets `z` to a copy of the denominator of `r`.
743 <a id="mp_rat_denom_ref"></a><pre>
744 mp_int <a href="imrat.h#L107">mp_rat_denom_ref</a>(mp_rat r);
746 - Returns a pointer to the denominator of `r`.
749 <a id="mp_rat_sign"></a><pre>
750 mp_sign <a href="imrat.h#L110">mp_rat_sign</a>(mp_rat r);
755 <a id="mp_rat_copy"></a><pre>
756 mp_result <a href="imrat.h#L115">mp_rat_copy</a>(mp_rat a, mp_rat c);
758 - Sets `c` to a copy of the value of `a`. No new memory is allocated unless a
759 term of `a` has more significant digits than the corresponding term of `c`
763 <a id="mp_rat_zero"></a><pre>
764 void <a href="imrat.h#L118">mp_rat_zero</a>(mp_rat r);
769 <a id="mp_rat_abs"></a><pre>
770 mp_result <a href="imrat.h#L121">mp_rat_abs</a>(mp_rat a, mp_rat c);
772 - Sets `c` to the absolute value of `a`.
775 <a id="mp_rat_neg"></a><pre>
776 mp_result <a href="imrat.h#L124">mp_rat_neg</a>(mp_rat a, mp_rat c);
778 - Sets `c` to the absolute value of `a`.
781 <a id="mp_rat_recip"></a><pre>
782 mp_result <a href="imrat.h#L128">mp_rat_recip</a>(mp_rat a, mp_rat c);
784 - Sets `c` to the reciprocal of `a` if the reciprocal is defined.
785 It returns `MP_UNDEF` if `a` is zero.
788 <a id="mp_rat_add"></a><pre>
789 mp_result <a href="imrat.h#L131">mp_rat_add</a>(mp_rat a, mp_rat b, mp_rat c);
791 - Sets `c` to the sum of `a` and `b`.
794 <a id="mp_rat_sub"></a><pre>
795 mp_result <a href="imrat.h#L134">mp_rat_sub</a>(mp_rat a, mp_rat b, mp_rat c);
797 - Sets `c` to the difference of `a` less `b`.
800 <a id="mp_rat_mul"></a><pre>
801 mp_result <a href="imrat.h#L137">mp_rat_mul</a>(mp_rat a, mp_rat b, mp_rat c);
803 - Sets `c` to the product of `a` and `b`.
806 <a id="mp_rat_div"></a><pre>
807 mp_result <a href="imrat.h#L141">mp_rat_div</a>(mp_rat a, mp_rat b, mp_rat c);
809 - Sets `c` to the ratio `a / b` if that ratio is defined.
813 <a id="mp_rat_add_int"></a><pre>
814 mp_result <a href="imrat.h#L144">mp_rat_add_int</a>(mp_rat a, mp_int b, mp_rat c);
816 - Sets `c` to the sum of `a` and integer `b`.
819 <a id="mp_rat_sub_int"></a><pre>
820 mp_result <a href="imrat.h#L147">mp_rat_sub_int</a>(mp_rat a, mp_int b, mp_rat c);
822 - Sets `c` to the difference of `a` less integer `b`.
825 <a id="mp_rat_mul_int"></a><pre>
826 mp_result <a href="imrat.h#L150">mp_rat_mul_int</a>(mp_rat a, mp_int b, mp_rat c);
828 - Sets `c` to the product of `a` and integer `b`.
831 <a id="mp_rat_div_int"></a><pre>
832 mp_result <a href="imrat.h#L154">mp_rat_div_int</a>(mp_rat a, mp_int b, mp_rat c);
834 - Sets `c` to the ratio `a / b` if that ratio is defined.
838 <a id="mp_rat_expt"></a><pre>
839 mp_result <a href="imrat.h#L158">mp_rat_expt</a>(mp_rat a, mp_small b, mp_rat c);
841 - Sets `c` to the value of `a` raised to the `b` power.
845 <a id="mp_rat_compare"></a><pre>
846 int <a href="imrat.h#L161">mp_rat_compare</a>(mp_rat a, mp_rat b);
848 - Returns the comparator of `a` and `b`.
851 <a id="mp_rat_compare_unsigned"></a><pre>
852 int <a href="imrat.h#L165">mp_rat_compare_unsigned</a>(mp_rat a, mp_rat b);
854 - Returns the comparator of the magnitudes of `a` and `b`, disregarding their
855 signs. Neither `a` nor `b` is modified by the comparison.
858 <a id="mp_rat_compare_zero"></a><pre>
859 int <a href="imrat.h#L168">mp_rat_compare_zero</a>(mp_rat r);
864 <a id="mp_rat_compare_value"></a><pre>
865 int <a href="imrat.h#L172">mp_rat_compare_value</a>(mp_rat r, mp_small n, mp_small d);
871 <a id="mp_rat_is_integer"></a><pre>
872 bool <a href="imrat.h#L175">mp_rat_is_integer</a>(mp_rat r);
877 <a id="mp_rat_to_ints"></a><pre>
878 mp_result <a href="imrat.h#L180">mp_rat_to_ints</a>(mp_rat r, mp_small *num, mp_small *den);
885 <a id="mp_rat_to_string"></a><pre>
886 mp_result <a href="imrat.h#L186">mp_rat_to_string</a>(mp_rat r, mp_size radix, char *str, int limit…
888 - Converts `r` to a zero-terminated string of the format `"n/d"` with `n` and
890 given output buffer `str`. The output of the numerator includes a sign flag
894 <a id="mp_rat_to_decimal"></a><pre>
895 mp_result <a href="imrat.h#L215">mp_rat_to_decimal</a>(mp_rat r, mp_size radix, mp_size prec, mp_ro…
897 - Converts the value of `r` to a string in decimal-point notation with the
903 a decimal value. There are four rounding modes currently supported:
933 <a id="mp_rat_string_len"></a><pre>
934 mp_result <a href="imrat.h#L221">mp_rat_string_len</a>(mp_rat r, mp_size radix);
936 - Reports the minimum number of characters required to represent `r` as a
941 <a id="mp_rat_decimal_len"></a><pre>
942 mp_result <a href="imrat.h#L226">mp_rat_decimal_len</a>(mp_rat r, mp_size radix, mp_size prec);
949 <a id="mp_rat_read_string"></a><pre>
950 mp_result <a href="imrat.h#L231">mp_rat_read_string</a>(mp_rat r, mp_size radix, const char *str);
952 - Sets `r` to the value represented by a zero-terminated string `str` in the
953 format `"n/d"` including a sign flag. It returns `MP_UNDEF` if the encoded
957 <a id="mp_rat_read_cstring"></a><pre>
958 mp_result <a href="imrat.h#L238">mp_rat_read_cstring</a>(mp_rat r, mp_size radix, const char *str, …
960 - Sets `r` to the value represented by a zero-terminated string `str` in the
961 format `"n/d"` including a sign flag. It returns `MP_UNDEF` if the encoded
966 <a id="mp_rat_read_ustring"></a><pre>
967 mp_result <a href="imrat.h#L252">mp_rat_read_ustring</a>(mp_rat r, mp_size radix, const char *str, …
969 - Sets `r` to the value represented by a zero-terminated string `str` having
983 <a id="mp_rat_read_decimal"></a><pre>
984 mp_result <a href="imrat.h#L258">mp_rat_read_decimal</a>(mp_rat r, mp_size radix, const char *str);
986 - Sets `r` to the value represented by a zero-terminated string `str` in the
987 format `"z.ffff"` including a sign flag. It returns `MP_UNDEF` if the
991 <a id="mp_rat_read_cdecimal"></a><pre>
992 mp_result <a href="imrat.h#L264">mp_rat_read_cdecimal</a>(mp_rat r, mp_size radix, const char *str,…
994 - Sets `r` to the value represented by a zero-terminated string `str` in the
995 format `"z.ffff"` including a sign flag. It returns `MP_UNDEF` if the
1007 IMath uses a signed magnitude representation for arbitrary precision integers.
1037 digits, and rounded up to the nearest `mp_word` boundary. There is a default
1038 minimum precision stored as a static constant default_precision (`imath.c`).
1042 reallocates in order to decrease the size. A simple way to do so explicitly is
1060 example, `mp_int_add(a, a, a)` is legal. Often, this means you must maintain
1063 maintain a conventional structure like this:
1085 If control reaches here via a REQUIRE failure, the code below
1094 and a jump label to handle cleanup. You may only have one `DECLARE_TEMP` and
1108 Rational numbers are represented using a pair of arbitrary precision integers,
1118 runs all available test vectors. If any tests fail, you will get a line like
1133 probably indicates a bug in the library (or at the very least, some assumption
1139 If you build with the preprocessor symbol `DEBUG` defined as a positive
1141 with the value `0xdeadbeefabad1dea`, or as much of it as will fit in a digit,
1146 1. <a name="note1"></a>You can generally use the same variables for both input
1150 2. <a name="note2"></a>Many of the tests for this library were written under
1152 with a smaller type, you may see `MP_RANGE` errors in some of the tests that
1163 include a complete description of what went wrong, and if possible, a test
1164 vector for `imtest` and/or a minimal test program that will demonstrate the bug
1182 Permission is hereby granted, free of charge, to any person obtaining a copy of
1194 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE