<div dir="auto">I'm still working in the MR. It works great but I'm having cmake issues on Windows. Adding a new third party library is tricky.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mar 21, 2018 2:08 PM, "Isaiah Norton" <<a href="mailto:isaiah.norton@gmail.com">isaiah.norton@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>+1. I needed this recently in Slicer, and ended up using ITK's version because we link it anyway.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">Not sure if we need to add a new third-party library for this, though,</div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;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">especially one that duplicates so much of C++'s built-in machinery.</div></blockquote><div><br></div><div> Grisu3 (double-conversion) appears to be ~13x faster than the C++ stream functions (and 6x faster than sprintf):</div><div><br></div> <a href="https://github.com/miloyip/dtoa-benchmark" target="_blank">https://github.com/miloyip/<wbr>dtoa-benchmark</a><br><div><br></div><div>Those numbers are on VS2013/Windows, but that code is easy to build locally. The sprintf vs double-conversion conclusion holds on 2015 macbook with 10.12 SDK. The C++ stream functionality is somewhat closer to sprintf.</div><div><br></div><div>[usual benchmark NaCl disclaimer here]</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 1, 2018 at 11:32 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I agree that floats should be printed so that conversion is lossless.<div>Python's console output does this and I find it incredibly useful.</div><div><br><div>Not sure if we need to add a new third-party library for this, though,</div><div>especially one that duplicates so much of C++'s built-in machinery.</div><div>Isn't it just a matter of printing enough digits? That's basically what</div><div>I do in my own code (plus checks for isnan(x) and isinf(x), and a</div><div>check of the size of fabs(x) for whether to force scientific notation.)</div><span class="m_4293024244260775483HOEnZb"><font color="#888888"><div><br></div><div> - David</div></font></span><div><div class="m_4293024244260775483h5"><div><br></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 1, 2018 at 8:48 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Will,<br>
<br>
It would go in Common/Core I think. The vtk class would be very small.<br>
<br>
Bill<br>
<br>
On Thu, Mar 1, 2018 at 7:36 AM, Will Schroeder<br>
<<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a>> wrote:<br>
> If it works why mess with success? Where would this class<br>
> (vtkNumberToString) be placed, in Common/Core (like vtkIndent) or in some IO<br>
> directory like VTK/IO/Core?<br>
><br>
> On Thu, Mar 1, 2018 at 10:06 AM, Bill Lorensen <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
> wrote:<br>
>><br>
>> 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/doub<wbr>le-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></blockquote></div></div></div></div></div></div></div></div>
<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/opensou<wbr>rce/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/listin<wbr>fo/vtk-developers</a><br>
<br>
<br></blockquote></div><br></div>
</blockquote></div></div>