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!

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...