Mirar @ Pike developers forum wrote:
> > 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.
That's a bignum which is not handled by the T_INT case.
>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)
This would indicate that the %f format specifier is indeed rather
unsuitable for a generic cast.
>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.)
Ok.
--
Sincerely,
Stephen R. van den Berg.
"If you try to fail and succeed, which have you done?"