axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Hawkins <HAWKI...@uk.ibm.com>
Subject Re: Number of decimal places in float (and decimal, double)
Date Tue, 14 Dec 2004 11:29:13 GMT




Hi Folks,

I've created a top of the head comparison list of types between xsd
definition, java representation and what we convert them to. There are
quite a few issues here and quite a few types that I have not dealt with.
This relates closely to http://nagoya.apache.org/jira/browse/AXISCPP-255.

You can see that we are not really adhering to the spec in some/many cases.
The question is - what do we wish to do? I'm not sure I have a strong
opinion here (for once ;-) Certainly some are more important than others
so, if we decide to purge these issues, we could prioritise those.

At the very least I suggest we complete this list and publish it.

|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| XSD Type     |XML Constraints             | Java            | Deserialise| Axis C serialise
as.             |Comments             | Deserialise |
|              |                            | interpretation  | as         |             
                    |                     | as          |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| String       | N/A                        | String          |char*       |             
                    |                     | char*       |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| integer      | derived from decimal       | math.BigInteger |long        |"%ld", *((long*)(pValue))
        |                     | long        |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| int          | derived from long          | Int             |Int         |"%d", *((int*)(pValue))
          |                     | int[] ?     |
|              | maxInc=2147483647          |                 |            |             
                    |                     |             |
|              | minInc=-2147483648         |                 |            |             
                    |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| long         | derived from integer       | long            |Win32:      |WIN32:       
                    |                     | Win32:      |
|              | maxInc=9223372036854775807 |                 |__int64     |"%lld", *((__int64*)(pValue))
    |                     | __int64     |
|              | minInc=-9223372036854775808|                 |#else       |#else        
                    |                     | #else       |
|              |                            |                 |long long   |"%lld", *((long
long*)(pValue))   |                     | long long   |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| short        | derived from int           | short           |short       |"%d", *((short*)(pValue))
        |                     | short       |
|              | maxInc=32767               |                 |            |             
                    |                     |             |
|              | minInc=-32768              |                 |            |             
                    |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| decimal      |must support 18 decimal     | bigDecimal      |double      |"%f", *((double*)(pValue))
       |'double' has a       | double      |
|              |digits                      |                 |            |             
                    |precision of 15      |             |
|              |                            |                 |            |             
                    |digits, not 18.      |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| float        | IEEE 32 bit standard-> mx  | float           |float       |"%f", *((float*)(pValue)))
       |Change to '%E' so    | float       |
|              | 2^e where                  |                 |            |             
                    |that the number      |             |
|              |m<2^24                      |                 |            |          
                       |always appears as    |             |
|              |-149<e<104                  |                 |            |       
                          |[+/-]#.#--#E[-]###.  |             |
|              |                            |                 |            |             
                    |Also type float does |             |
|              |                            |                 |            |             
                    |not have sufficient  |             |
|              |                            |                 |            |             
                    |precision            |             |
|              |                            |                 |            |             
                    |(3.402823466E38 > n >|             |
|              |                            |                 |            |             
                    |1.175494351E-38).    |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| double       | IEEE 64 bit standard->     | double          |double      |"%f", *((double*)(pValue))
       |                     | double      |
|              | mx2^e where                |                 |            |             
                    |                     |             |
|              | m<2^53                     |                 |            |          
                       |                     |             |
|              | -1075<e<970                |                 |            |       
                          |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| boolean      |                            | boolean         |Int         |{true, false}
                    |                     | ?           |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| byte         | derived from short         | byte            |char        |"%d", *((char*)(pValue)))
        |                     | char        |
|              | maxInc=127                 |                 |            |             
                    |                     |             |
|              | minInc=-128                |                 |            |             
                    |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| dateTime     |                            | Calendar        |            |             
                    | Only 1st Jan 1970   |             |
|              |                            |                 |            |             
                    | onwards plus other  |             |
|              |                            |                 |            |             
                    | issues.             |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| duration     | ISO 8601                   |                 |            |m_AxisTime.serialize(
            |                     |             |
|              |                            |                 |            |            *((long*)(pValue)),
  |                     |             |
|              |                            |                 |            |type).c_str ())
                  |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| base64Binary |                            | byte[]          |char*       |             
                    |                     | char*       |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
| hexBinary    |                            | byte[]          |char*       |             
                    |                     | char*       |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|
|              |                            |                 |            |             
                    |                     |             |
|--------------+----------------------------+-----------------+------------+----------------------------------+---------------------+-------------|


John Hawkins




                                                                           
             Samisa Abeysinghe                                             
             <samisa.abeysingh                                             
             e@gmail.com>                                               To 
                                       Apache AXIS C Developers List       
             14/12/2004 04:30          <axis-c-dev@ws.apache.org>          
                                                                        cc 
                                                                           
             Please respond to                                     Subject 
              "Apache AXIS C           Re: Number of decimal places in     
             Developers List"          float (and decimal, double)         
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




OK, I found a solution to go beyond the 4 decimal place limit.

However, there still would be some element of error involved (but very
small, about
0.0000000000001) I think this is acceptable.

Samisa...


On Tue, 14 Dec 2004 01:32:25 +0000, Samisa Abeysinghe
<samisa.abeysinghe@gmail.com> wrote:
> Sanjiva, the standard functions (e.g. sprintf, strtod, etc.) that we
> are using in serialization/deserialization does not seem to retain
> precision the way we want. There are some work-arounds but does not
> work exctly the way we want them to.
>
> John, yes I will have a look at XSD spec. I think that is the best
> thing to do in order to find out what we sould be supporting.
>
> Thanks,
> Samisa...
>
>
>
>
> On Mon, 13 Dec 2004 21:57:36 +0600, Sanjiva Weerawarana
> <sanjiva@opensource.lk> wrote:
> > Yes I agree.
> >
> > Samisa, why wouldn't we retain all the precision that's available?
> > Maybe I don't understand the issue (entirely possible!).
> >
> > Sanjiva.
> >
> >
> >
> > ----- Original Message -----
> > From: "John Hawkins" <HAWKINSJ@uk.ibm.com>
> > To: "Apache AXIS C Developers List" <axis-c-dev@ws.apache.org>
> > Sent: Monday, December 13, 2004 7:01 PM
> > Subject: Re: Number of decimal places in float (and decimal, double)
> >
> > >
> > >
> > >
> > >
> > > This is a huge area that I can't see we've discussed before?
> > >
> > > To my logic we should be looking at the attributes on the types for
their
> > > description of what they are expecting shouldn't we ?
> > >
> > >
> > > John Hawkins
> > >
> > >
> > >
> > >
> > >
> > >              Samisa Abeysinghe
> > >              <samisa.abeysingh
> > >              e@gmail.com>
To
> > >                                        Apache AXIS C Developers List
> > >              13/12/2004 09:10          <axis-c-dev@ws.apache.org>
> > >
cc
> > >
> > >              Please respond to
Subject
> > >               "Apache AXIS C           Number of decimal places in
float
> > >              Developers List"          (and decimal, double)
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hi Folks,
> > >    As per http://nagoya.apache.org/jira/browse/AXISCPP-320, are we
> > > happy with a 4 decimal place acuracy, or do we need more decimal
> > > places be represented correctly?
> > >
> > > Thanks,
> > > Samisa...
> > >
> > >
> > >
> >
> >
>



Mime
View raw message