[vtk-developers] Call for Comments: Ascii representation of floats and doubles in files

Bill Lorensen bill.lorensen at gmail.com
Thu Mar 1 11:06:41 EST 2018


IO/Core  will work unless we see uses elsewhere.

Bill

On Thu, Mar 1, 2018 at 7:59 AM, Berk Geveci <berk.geveci at kitware.com> wrote:
> Given that this is IO specific, I would vote for IO/Core. No need to pollute
> Common/Core more than it already is (which is a lot IMO).
>
> On Thu, Mar 1, 2018 at 10:36 AM, Will Schroeder <will.schroeder at kitware.com>
> wrote:
>>
>> If it works why mess with success? Where would this class
>> (vtkNumberToString) be placed, in Common/Core (like vtkIndent) or in some IO
>> directory like VTK/IO/Core?
>>
>> On Thu, Mar 1, 2018 at 10:06 AM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>>>
>>> Folks,
>>>
>>> I'm working on some examples to save/restore camera, polydata,
>>> property, etc. in XML files. The files can be saved as binary or
>>> ascii. If I save/restore the info in binary, I get the same values for
>>> the saved info. But, to no surprise, when I save the same data in
>>> ascii, I don't get the same values. This is because the file writing
>>> code does not write enough significant digits.
>>>
>>> In ITK we solved this problem many years ago. ITK uses a reduced
>>> version of the Google double-conversion library,
>>> https://github.com/google/double-conversion.
>>>
>>> We added a small class to ITK that uses the library. The class,
>>> itkNumberToString, has a simple API. To convert floating and fixed
>>> point numbers to ascii without numerical precision erros,
>>>
>>> For example, to convert a float,
>>> #include "itkNumberToString.h:
>>> itk::NumberToString<float> convert;
>>> float a = 1.0f/3.0f;
>>> std::cout << convert(a) << std::endl;
>>>
>>> I propose a similar approach in VTK.
>>>
>>> Comments please,
>>>
>>> Bill
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> https://vtk.org/mailman/listinfo/vtk-developers
>>>
>>
>>
>>
>> --
>> William J. Schroeder, PhD
>> Kitware, Inc. - Building the World's Technical Computing Software
>> 28 Corporate Drive
>> Clifton Park, NY 12065
>> will.schroeder at kitware.com
>> http://www.kitware.com
>> (518) 881-4902
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>>
>> Follow this link to subscribe/unsubscribe:
>> https://vtk.org/mailman/listinfo/vtk-developers
>>
>>
>



-- 
Unpaid intern in BillsParadise at noware dot com


More information about the vtk-developers mailing list