Skip to main content

Hi

I have an attribute value derived from an Excel sheet. The input attribute name is “Vægt”. FME data type is number(20,2). An example value for a feature is “2.95”. I’m trying to retrieve this value using the xml templater using <Cell><Data Type="Number">{fme:get-attribute("Vægt")}</Data></Cell> 

 

 

But the output value in the xml is 2.9500000000000002

 

Could anyone explain why this is happening and suggest a fix? I have tried attribute rounding and changing the input Data Type but nothing seems to work.

 

Thanks

The reason why: https://support.safe.com/hc/en-us/articles/25407633363981-Floating-Point-Precision-and-String-Formatting-in-FME

Workaround: 

Example:

<tag>{fn:round(xs:double(fme:get-attribute("Vægt")), 2)}</tag>

Thanks David that worked!