Splunk Search

eval - inconsistent math result

splunk_zen
Builder

How is it possible that an eval expression which its components total weight is 100, breach that expected value?

For a given period, I'm getting a result of 101,

while expression components weights are (it totals to 100)

100*(0.08 + 0.03 + 0.12 + 0.16 + 0.06 + 0.18 + 0.06 + 0.06 + 0.25)

and there is not even one component value which exceeds 1.

| eval TimeoutScore=100*( 
0.08*(bw1sdpSdfPccCsApdex) 
+ 0.03*bw1sdpSdfPccMnCsApdex 
+ 0.12*bw1sdpSdfPccPsApdex 
+ 0.16*(0.5*bw1sdpSdfPpsCsApdex +0.5*bw2sdpSdfPpsCsApdex) 
+ 0.06*(0.5*bw1sdpSdfPpsMnCsApdex +0.5*bw2sdpSdfPpsMnCsApdex)
+ 0.18*(0.5*bw1sdpSdfPpsPsApdex + 0.5*bw2sdpSdfPpsPsApdex)
+ 0.06*(0.5*bw1sdpSdfPpsVisaCsApdex + 0.5*bw2sdpSdfPpsVisaCsApdex) 
+ 0.06*bw1careSdfMnApdex 
+ 0.25*(0.5*bw1sdpSdfSlrApdex + 0.5*bw2sdpSdfSlrApdex))
| stats sum(TimeoutScore) as TimeoutScore sum(bw1sdpSdfPccCsApdex) sum(bw1sdpSdfPccMnCsApdex)     sum(bw1sdpSdfPccPsApdex) sum(bw1sdpSdfPpsCsApdex) sum(bw2sdpSdfPpsCsApdex) sum(bw1sdpSdfPpsMnCsApdex) sum(bw2sdpSdfPpsMnCsApdex) sum(bw1sdpSdfPpsPsApdex) sum(bw2sdpSdfPpsPsApdex) sum(bw1sdpSdfPpsVisaCsApdex) sum(bw2sdpSdfPpsVisaCsApdex) sum(bw1careSdfMnApdex) sum(bw1sdpSdfSlrApdex) sum(bw2sdpSdfSlrApdex)


TimeoutScore    sum(bw1sdpSdfPccCsApdex)    sum(bw1sdpSdfPccMnCsApdex)  sum(bw1sdpSdfPccPsApdex)    sum(bw1sdpSdfPpsCsApdex)    sum(bw2sdpSdfPpsCsApdex)    sum(bw1sdpSdfPpsMnCsApdex)  sum(bw2sdpSdfPpsMnCsApdex)  sum(bw1sdpSdfPpsPsApdex)    sum(bw2sdpSdfPpsPsApdex)    sum(bw1sdpSdfPpsVisaCsApdex)    sum(bw2sdpSdfPpsVisaCsApdex)    sum(bw1careSdfMnApdex)  sum(bw1sdpSdfSlrApdex)  sum(bw2sdpSdfSlrApdex)
101 1   0.854839    0.972727    1   1   1   1   0.975410    1   1   1   0.983871    1   1

EDIT:
Thanks to kristian.kolb suggestion, this issue was solved replacing

| eval TimeoutScore=...

by

| eval TimeoutScore=exact(...)
Tags (2)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

splunk_zen
Builder

Dammit... Forgot that could be the culprit.
If you promote the comment to an answer I will gladly accept it 🙂

0 Karma

kristian_kolb
Ultra Champion

Rounding errors? perhaps the exact() function for eval might help?

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/CommonEvalFunctions

Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...