Suggestion for a clarification in the documentation of	"Formatted Input Strings"
    Will Galway 
    galway at math.uiuc.edu
       
    Sat May 15 16:12:33 CEST 2010
    
    
  
One of the examples of formatted input reads like this:
------------------------------------------------------------------
     /* to read say "a(5) = 1234" */
     int   n;
     mpz_t z;
     gmp_scanf ("a(%d) = %Zd\n", &n, z);
------------------------------------------------------------------
(See, for example, 
http://gmplib.org/manual/Formatted-Input-Strings.html#Formatted-Input-Strings 
)
I find the mention of "a(5)" confusing. For one thing, the example seems 
intended to read "5", and not the value of "a(5)", i.e., "a[5]" in 
proper C notation.  Instead you might say something along the lines of:
------------------------------------------------------------------
     /* to read say an integer "n" and an mpz_t "z".  */
     int   n;
     mpz_t z;
     gmp_scanf ("%d %Zd\n", &n, z);
Given the input line "5 1234567890123456789012345678901234567890", this 
would set "n = 5" and
"z = 1234567890123456789012345678901234567890".
------------------------------------------------------------------
My suggested example could certainly be improved, and, of course, I'm 
writing things like in quotations where it would be better to use 
appropriate fonts.
-- Regards, Will Galway
    
    
More information about the gmp-bugs
mailing list