<div dir="ltr">If it works why mess with success? Where would this class (vtk<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:16px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">NumberToString) </span>be placed, in Common/Core (like vtkIndent) or in some IO directory like VTK/IO/Core?</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 1, 2018 at 10:06 AM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Folks,<br>
<br>
I'm working on some examples to save/restore camera, polydata,<br>
property, etc. in XML files. The files can be saved as binary or<br>
ascii. If I save/restore the info in binary, I get the same values for<br>
the saved info. But, to no surprise, when I save the same data in<br>
ascii, I don't get the same values. This is because the file writing<br>
code does not write enough significant digits.<br>
<br>
In ITK we solved this problem many years ago. ITK uses a reduced<br>
version of the Google double-conversion library,<br>
<a href="https://github.com/google/double-conversion" rel="noreferrer" target="_blank">https://github.com/google/<wbr>double-conversion</a>.<br>
<br>
We added a small class to ITK that uses the library. The class,<br>
itkNumberToString, has a simple API. To convert floating and fixed<br>
point numbers to ascii without numerical precision erros,<br>
<br>
For example, to convert a float,<br>
#include "itkNumberToString.h:<br>
itk::NumberToString<float> convert;<br>
float a = 1.0f/3.0f;<br>
std::cout << convert(a) << std::endl;<br>
<br>
I propose a similar approach in VTK.<br>
<br>
Comments please,<br>
<br>
Bill<br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=<wbr>vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">https://vtk.org/mailman/<wbr>listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>William J. Schroeder, PhD<br>Kitware, Inc. - Building the World's Technical Computing Software<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br><a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br>(518) 881-4902</div></div></div>
</div>