- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Hi All,
I have always wondered why we have 2 types of floating number related field in ServiceNow. I thought to discover and see which should be rightly used in which scenarios.
Let's see:
1. Float Field
Float Type field in ServiceNow is majorly used to store numbers using floating-point arithmetic (approximate values).
Let's see how it works:
Based on binary floating-point representation
Can introduce rounding errors
Best suited for scientific or approximate calculations
Pros
- Faster calculations
- Uses less storage
- Good for non-critical precision values
Cons
Precision issues
Not reliable for currency or exact totals
🧪 Example
0.1 + 0.2 = 0.30000000000000004
Common Use Cases
- Performance metrics
- Percentages
- Calculated averages
- Measurements (CPU, memory, response time)
2. Decimal Field
Decimal type field usually used to store the numbers with exact precision.
Pros
- Accurate and predictable
- Ideal for financial and business data
Cons
- Slightly slower than float
- Uses more storage
🧪 Example
0.1 + 0.2 = 0.3
Common Use Cases
- Currency amounts
- Prices, costs, budgets
- SLAs and contractual values
- Procurement & billing (Source to Pay, CSM, FSM)
I have seen people using sometimes Decimal or Float which makes the backend calculation difficult. It should be consistent throughout the process you are building.
If you want the exact précised value to be given, then use Decimal else use "Float". It depends on what process you are building and the type of requirement you have.
Simple learning for the day!
Thanks,
Shamma Negi
ServiceNow CTA
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
