Well, for one, what is the largest integer type to be expected in the svalue (without bignums)? Is that INT_TYPE instead of INT32?
My Pikes has been running 64 bits there for around 8 years... So yes.
sizeNUM(double) * 2
should normally overestimate the total maximum stringsize by roughly a factor of two, which is a safe margin for unexpected floating point formatting options. Then again, we could start using snprintf there.
Not exactly.
strlen((string)1e100);
(1) Result: 108
108 >> 27.
Fun fact:
strlen((string)1e200);
*** stack smashing detected ***: pike terminated ======= Backtrace: ========= /lib/libc.so.6(__fortify_fail+0x37)[0x2aff8e019607] /lib/libc.so.6(__fortify_fail+0x0)[0x2aff8e0195d0] pike(o_cast_to_string+0x558)[0x4ea998]
(latest CVS)
And I'm sure you'd like to use FLOAT_TYPE since it can actually be set to long double. (I'm not sure how well it works, but it's a theory.)