On Fri, May 16, 2014 at 10:30:27AM -0700, julien2412 [via Document Foundation Mail Archive] wrote:
<br/><br/>> I noticed this:
<br/>> s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<double>::get();
<br/>> present at 2 locations:
<br/>> See
<br/>> <a href="http://opengrok.libreoffice.org/search?q=%22GetXMLToken%28+XML_FLOAT%29%22&project=core&defs=&refs=&path=&hist=" target="_top" rel="nofollow" link="external">http://opengrok.libreoffice.org/search?q=%22GetXMLToken%28+XML_FLOAT%29%22&project=core&defs=&refs=&path=&hist=</a><br/><br/>> Why shouldn't be this:
<br/>> s_aTypeNameMap[GetXMLToken( XML_FLOAT)] = ::cppu::UnoType<float>::get();
<br/>> ?
<br/><br/>Also in xmloff/source/forms/propertyimport.cxx (which is not found by
<br/>the above search).
<br/><br/>In that file I also see:
<br/><br/> token::XMLTokenEnum OPropertyExport::implGetPropertyXMLType(const ::com::sun::star::uno::Type& _rType)
<br/> {
<br/> // handle the type description
<br/> switch (_rType.getTypeClass())
<br/> {
<br/> case TypeClass_DOUBLE:
<br/> case TypeClass_BYTE:
<br/> case TypeClass_SHORT:
<br/> case TypeClass_LONG:
<br/> case TypeClass_HYPER:
<br/> case TypeClass_ENUM:
<br/> return token::XML_FLOAT;
<br/><br/><br/>So there, clearly, all numeric types (including the UNO double)
<br/>consistently map to XML_FLOAT, so taking the extra precision from the
<br/>C++ type "float" to "double" makes absolute sense. What is called
<br/>"float" in XML seems to be the general notion of number, not
<br/>specifically the IEE754 single precision 32-bit floating point.
<br/><br/><br/>Looking into an .odb file's reports, I don't see "double" used at
<br/>all. Again, "float" seems to be used in the general sense of
<br/>"number". This is confirmed by
<br/><a href="http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1417680_253892949" target="_top" rel="nofollow" link="external">http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1417680_253892949</a><br/>which shows that the ODF format uses the XML token "float" to mean
<br/>"number", and does not have a difference between the notion of
<br/>"integer" and "floating point", much less between different precision
<br/>levels of floating point data types.
<br/><br/>So again, it makes sense to use the C++ type "double" for that (extra
<br/>precision, matches the type used by our numeric formatters, ...).
<br/><br/>--
<br/>Lionel
<br/>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://nabble.documentfoundation.org/Question-unoType-for-getXmlToken-dbaccess-reportdesign-module-tp4109071p4109116.html">Re: Question unoType for getXmlToken (dbaccess/reportdesign module)</a><br/>
Sent from the <a href="http://nabble.documentfoundation.org/Dev-f1639786.html">Dev mailing list archive</a> at Nabble.com.<br/>