Splunk Search

rounding function round(x,y) returns 100 instead of 99,99

net1993
Path Finder

Hi
Lets say I have value of 99.99875547590601 and I want to get only 99,99 so I use the function round(99.99875547590601,2) which returns 100 instead of 99,99.
I think this behaviour might be normal but so what can I do instead of round to get precise result?

Thank you.

Tags (1)
0 Karma

vnravikumar
Champion

Hi

Try like

| makeresults 
| eval num=99.99875547590601 
| rex field=num "(?P<output>\d{1,}\.\d{2})"
0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...