[ 
http://issues.apache.org/jira/browse/AXISCPP-838?page=comments#action_12358364 
] 

Fred Preston commented on AXISCPP-838:
--------------------------------------

A post script to the above comment is the following:-

When you use:-

xsd__float myFloat = 555.555;

This will be represented in the float type as 555.55499.  Thus, if your code 
prints out myFloat using:-

printf( "%f\n", myFloat);

you will get:-

555.55499

But, we have said that float only has an accuracy of 6 digits, so we have to 
use the correct formatting to get the correct result.  To do this, replace %f 
with %.6g for a float and %.10g for a double.  Thus, if we have:-

printf( "%.6g", myFloat);

you will get:-

555.555

Giving the correct result to the proper resolution.


> The serialisation of 555.555 as a float produces a value of 555.554993 on the 
> wire.
> -----------------------------------------------------------------------------------
>
>          Key: AXISCPP-838
>          URL: http://issues.apache.org/jira/browse/AXISCPP-838
>      Project: Axis-C++
>         Type: Bug
>   Components: Serialization
>  Environment: n/a
>     Reporter: Fred Preston
>     Assignee: Fred Preston

>
> Using the UnitTest_XSD_float test.  If you change the code as follows:-
> Was
> [40]// Test non-nillable element
> [41]      xsd__float result = ws->asNonNillableElement((xsd__float)35.353588);
> Now
> [40]// Test non-nillable element
> [41]      xsd__float result = ws->asNonNillableElement((xsd__float)555.555);
> Then on the wire you get:-
> <nonNillableElement>555.554993</nonNillableElement>

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to