1 /* TomsFastMath, a fast ISO C bignum library.
3 * This project is meant to fill in where LibTomMath
4 * falls short. That is speed ;-)
6 * This project is public domain and free for all purposes.
8 * Tom St Denis, tomstdenis@gmail.com
10 #include <tfm_private.h>
12 int fp_radix_size(fp_int *a, int radix, int *size)
19 /* check range of the radix */
20 if (radix < 2 || radix > 64) {
24 /* quick out if its zero */
25 if (fp_iszero(a) == 1) {
32 /* if it is negative output a - */
33 if (t.sign == FP_NEG) {
38 while (fp_iszero (&t) == FP_NO) {
39 fp_div_d (&t, (fp_digit) radix, &t, &d);
43 /* append a NULL so the string is properly terminated */