Karim Belabas on Fri, 22 Dec 2017 16:21:27 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: t_QUAD printed representation |
* Sam Steingold [2017-12-22 15:37]: > Hi, > > For clarity sake: the issue is read/print consistency. > I should be able to save and recover an object using its text > representation This is sadly not the case. The only way to "save and recover" an *identical* object is to use writebin / read. ( And even then, this depends on a sane session context : variable ordering, etc... ) > without special cases for t_QUAD (and what other types?) t_QUAD is the worst but there are other caveats. > IOW, for any object x and any string s, the following should hold: > > gequal(gp_read_str(GENtostr_raw(x)),x) = 1 > strcmp(s,GENtostr_raw(gp_read_str(x))) = 0 It doesn't hold in general: the only way to reliably transmit a completely general object is to serialize it and use binary data (we use this intensively e.g for MPI interface), not convert to string and back. Besides, conversion from and to binary is much faster than string representations. What is your exact use case ? Cheers, K.B. -- Karim Belabas, IMB (UMR 5251) Tel: (+33) (0)5 40 00 26 17 Universite de Bordeaux Fax: (+33) (0)5 40 00 21 23 351, cours de la Liberation http://www.math.u-bordeaux.fr/~kbelabas/ F-33405 Talence (France) http://pari.math.u-bordeaux.fr/ [PARI/GP] `