Saturday, 15 August 2015

xmlserializer - C# magic double value parse -



xmlserializer - C# magic double value parse -

currently working numbers high precisions in complex calculations. of results , source info should stored in serialized form. till magic double value: 0.00000060912702792848.

writing value string (that xmlwriter does):

s = d.tostring("r", numberformatinfo.invariantinfo);

gives expected result 6.0912702792848e-07.

but magic starts when seek double value (the way how xmlreader works):

d=double.parse(s, numberstyles.float, numberformatinfo.invariantinfo);

converted value 0.00000060912702792848005 005 digits @ end.

it looks special combination of numbers gives such result. miss?

environment: windows 7 professional, 64-bit.

although not reply question, if want rid of decimals @ end, may use:

s = d.tostring("g20", numberformatinfo.invariantinfo);

double xmlserializer

No comments:

Post a Comment