X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/7383bc11a43ad9cc6bb0229ad3f2686fc999e8a4..75263f25a1ce8e7b38ad4bd61a9a893723ec1db3:/mptext.h diff --git a/mptext.h b/mptext.h index db4e591..57c4dc2 100644 --- a/mptext.h +++ b/mptext.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mptext.h,v 1.5 2000/10/08 12:04:58 mdw Exp $ + * $Id: mptext.h,v 1.6 2002/10/15 22:58:29 mdw Exp $ * * Textual representation of multiprecision numbers * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mptext.h,v $ + * Revision 1.6 2002/10/15 22:58:29 mdw + * Fast estimation of number representation lengths. + * * Revision 1.5 2000/10/08 12:04:58 mdw * (MP_DOFPRINTFR): cope with null pointers. * @@ -107,6 +110,20 @@ extern mp *mp_read(mp */*m*/, int /*radix*/, extern int mp_write(mp */*m*/, int /*radix*/, const mptext_ops */*ops*/, void */*p*/); +/* --- @mptext_len@ --- * + * + * Arguments: @mp *x@ = number to work on + * @int r@ = radix the number will be expressed in + * + * Returns: The number of digits needed to represent the number in the + * given base. This will not include space for a leading sign + * (use @MP_ISNEG@ to check that, or just add one on for luck); + * neither will it add space for a terminating null. In general + * the answer will be an overestimate. + */ + +extern size_t mptext_len(mp */*x*/, int /*r*/); + /*----- File I/O ----------------------------------------------------------*/ #include