[Dcmlib] not using double for high precision

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Mar 5 21:52:29 CET 2007


Dennis wrote:
> Hi,
>  
> In gdcm::File, float File::GetXOrigin() will lost some precision. I 
> think it should provide as: double File::GetXOrigin()...
> for example, if -13.1 is converted to float in GetXOrigin(), actually 
> it will return as -13.1000000381470.

No :)
In the next generation of GDCM, it will be much more strongly typed. If 
the DICOM standard specify a Tag should be expressed as 16bits floating, 
we should return from a function with the most appropriate c++ type: float.
So in conclusion, no you are not loosing precision, you are explicitly 
made aware by GDCM of the DICOM standard :)

-M



More information about the Dcmlib mailing list