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!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...