Select to view content in your preferred language

Decimal Places in Attribute Pane

176
2
Jump to solution
3 weeks ago
LukeGilner1
Frequent Contributor

I'm using a hosted feature layer in ArcPro with a Float data type field.  I have the decimal places set to 2.  The number entered only shows as 1 decimal place in the Attribute Table and Pane.  When you click to edit the number, it shows 16 decimals of superfluous numbers.  So, if I enter 2.4 in the field, it shows 2.4000000953674316.  If I look at the data in AGOL, it'll show 2.40, but when clicked to edit shows 2.4000000953674316.  What is going on?  Why does it just make up numbers?  I assume it has something to do with how it was published, but I have no idea.

Here's a snip from the Attribute Pane as displayed, and when you try to edit.

LukeGilner1_0-1755186138356.png

LukeGilner1_1-1755186199618.png

 

 

0 Kudos
1 Solution

Accepted Solutions
DanielFox1
Esri Regular Contributor

Hi @LukeGilner1 

Float uses 32 bit precision, meaning that it cannot store exact decimal values like to 2.4 cleanly in binary. So when you enter 2.4 it will store it very close to 2.4 such as 2.4000000953674316. This is a limitation with binary floating point representation not a defect in ArcGIS. 

In ArcGIS Pro and ArcGIS Online the value is formatted to 2 decimal places for display but when editing you see the raw stored value. 

How you can resolve this. 

1. Use Double instead of Float 

Double is 64 bit and has better precision. You will need to make a new field that has double and recalculate the values again. 

If you need exact formatting to always show 2.4 for example you can create a calculated text field that formats the number as a string. 

Example: Text($feature.YourFloatField, "#.00") 

This should avoid floating point issue entirely for display purposes. 

View solution in original post

2 Replies
DanielFox1
Esri Regular Contributor

Hi @LukeGilner1 

Float uses 32 bit precision, meaning that it cannot store exact decimal values like to 2.4 cleanly in binary. So when you enter 2.4 it will store it very close to 2.4 such as 2.4000000953674316. This is a limitation with binary floating point representation not a defect in ArcGIS. 

In ArcGIS Pro and ArcGIS Online the value is formatted to 2 decimal places for display but when editing you see the raw stored value. 

How you can resolve this. 

1. Use Double instead of Float 

Double is 64 bit and has better precision. You will need to make a new field that has double and recalculate the values again. 

If you need exact formatting to always show 2.4 for example you can create a calculated text field that formats the number as a string. 

Example: Text($feature.YourFloatField, "#.00") 

This should avoid floating point issue entirely for display purposes. 

LukeGilner1
Frequent Contributor

Thank you for explaining that!  I thought I would try to save a little space by using a 32 bit data type versus the 64 bit, but I didn't realize that part of it.

Unfortunately, this layer is being utilized by several users in Field Maps, so I cannot make significant changes to the schema which would cause syncing issues.  I'll have to live with it for now. 

Thanks for your response!

0 Kudos