Skip to main content

Hi,

i'm trying to read features from a GDB and to import them into another GDB. The two GDB are basically the same thing just that in the start GDB some features are defined as "Double" while in target GDB they are defined as "Float".

When i inspect the data from the reader in Data inspector i can see that some features look f.e. like 2603368.3700000001 instead of 2603368.37 (they all have maximum 2 decimals) and when I write them in the target GDB the decimals are completly gone.

I tried to round them with "AttributeRounder" before write them and to change the "User Attribute Type" in the writer but it didnt help.

Can anyone see what I am doing wrong?

Thank you very much

The difference between the double and float datatypes in a File Geodatabase is that a float is comprised of 4 bytes of storage space, where as the double is twice as large, 8 bytes.

This means that the possible span of values is much larger for doubles than for floats:

Float: approximately -3.4E38 to 1.2E38

Double: approximately -2.2E308 to 1.8E308

As long as your values are e.g. inside the range of a float, there should be no difference to storing those values as either floats or doubles, except for the storage space.

What you're observing is due to rounding issues, it's incredibly common and this site explains it fairly well: https://floating-point-gui.de/

 


The difference between the double and float datatypes in a File Geodatabase is that a float is comprised of 4 bytes of storage space, where as the double is twice as large, 8 bytes.

This means that the possible span of values is much larger for doubles than for floats:

Float: approximately -3.4E38 to 1.2E38

Double: approximately -2.2E308 to 1.8E308

As long as your values are e.g. inside the range of a float, there should be no difference to storing those values as either floats or doubles, except for the storage space.

What you're observing is due to rounding issues, it's incredibly common and this site explains it fairly well: https://floating-point-gui.de/

 

Hi,

thank you very much for you answer and the very interesting link. The goal of the exercise would be precisely to have all the features stored into float to save space. So (if I got it right) my exemple feature with a value of 2603368.3700000001 is inside both ranges. The question now is why when I write them into the target GDB I loose all the decimals?


Hi,

thank you very much for you answer and the very interesting link. The goal of the exercise would be precisely to have all the features stored into float to save space. So (if I got it right) my exemple feature with a value of 2603368.3700000001 is inside both ranges. The question now is why when I write them into the target GDB I loose all the decimals?

I couldn't tell without more details. Are you able to post a minimal workspace here that demonstrates the issue?


I couldn't tell without more details. Are you able to post a minimal workspace here that demonstrates the issue?

The workspace is actually very simple, just a reader and a writer. The thing is that it looks like that attribute must be defined as a double, if it's defined as float it just doesnt work...

https://desktop.arcgis.com/en/arcmap/latest/manage-data/geodatabases/arcgis-field-data-types.htm


Reply