Add method to compute the number of digits of a HYPRE_BigInt

This commit is contained in:
victorapm@tux 2019-06-06 10:33:21 -07:00
parent 551703ad65
commit d508cc8a57
2 changed files with 15 additions and 0 deletions

View File

@ -1785,6 +1785,7 @@ void HYPRE_Finalize();
/* hypre_printf.c */
// #ifdef HYPRE_BIGINT
HYPRE_Int hypre_ndigits( HYPRE_BigInt number );
HYPRE_Int hypre_printf( const char *format , ... );
HYPRE_Int hypre_fprintf( FILE *stream , const char *format, ... );
HYPRE_Int hypre_sprintf( char *s , const char *format, ... );

View File

@ -116,6 +116,20 @@ free_format( char *newformat )
return 0;
}
HYPRE_Int
hypre_ndigits( HYPRE_BigInt number )
{
HYPRE_Int ndigits = 0;
while(number)
{
number /= 10;
ndigits++;
}
return ndigits;
}
/* printf functions */
HYPRE_Int