[phpxmlrpc-devel] double/float number encoding
Brought to you by:
ggiunta
From: lukasz m. <lu...@ma...> - 2003-01-17 06:16:08
|
there is a problem with very big(or very small) float numbers. php automagically converts it to scientific number for example 1300000000000000000000 to 1.3e21 xmlrpc server accepts it as valid double value, but xmlrpc client "converts" it to ERROR_NON_NUMERIC_FOUND, because it doesn't match to "^[0-9\+\-\.]+$" regexp. i see 2 solutions: 1) let php server accept scientific format, and replace regexp based check by is_float(). but xmlrpc specification is unclear for me, and i'm not sure if it allow scientific format of double number. 2) convert every big or small double to normal format using sprintf and proper precision modifier. but it can generate amount of unneeded data (1.3e55 takes 6 bytes, 13000....0000 takes 56 bytes). what do you think about it? pozdrav maHo |