Re: R: [phpxmlrpc-devel] is this list working?
Brought to you by:
ggiunta
From: lukasz m. <lu...@ma...> - 2003-01-23 15:52:15
|
Gaetano Giunta wrote: >>so i'm wondering if those mail successfull arrived to list. >> > > > yes, it deed funny, when i asked this question, suddenly both mails (last and those about floats) appeared on sourceforge. maybe there is some kind of buffer, which have to be overflowed to appear message on board? > > >>had anybody read mail about float/double numbers encoding? >> > > > I am in no way a major developer of the lib, here's my take anyway: > > >>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. >> > > > The spec is deceptively simple in many places, here's the concerning paragraph: > > # What is the legal syntax (and range) for floating point values (doubles)? How is the exponent represented? How to deal with whitespace? Can infinity and "not a number" be represented? > > There is no representation for infinity or negative infinity or "not a number". At this time, only decimal point notation is allowed, a plus or a minus, followed by any number of numeric characters, followed by a period and any number of numeric characters. Whitespace is not allowed. The range of allowable values is implementation-dependent, is not specified. > > As far as my understanding goes, NO scientific notation allowed. it isn't forbidden explicit. but it looks like you're right. [ciach] > >>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). >> > > > A very large amount of data indeed, but it is the only way to go! and problem is, how to code VERY BIG float to non-scientific format. simply sprintf(%f,$number) seems to be not working properly. printf("%f",1.3e200) produces 1299999999999997700000000000000000000000000000000000000000000000000000000000000.00000000 which is near 1.3e78. 1.3e200 should by inside double range. so maybe we should consider allow to use scientific format? regards maHo |