In v7.1.2, a SPL
| makeresults count=1 | eval num="1234567890123456789012345678901234567890"
returns 1234567890123456789012345678901234567890
as string. However,
| makeresults count=1
| eval num1="1234567890123456789012345678901234567890", num2=1
| eval total=num1+num2
returns rounded 'total' value 1234567890123456800000000000000000000000
.
(We want true result 1234567890123456789012345678901234567891
.)
Can we treat long digit decimal number correctly in SPL?
@kamlesh_vaghela
It's a nice idea using custom app to enable treat long digit decimals like as BigDecimal in Java.
It is same as other computer language, implementation of real numbers in Splunk's has limitation.
@woodcock
I think the limitation is not problem essentially.
However it may become potential of unexpected behaviors for non-technical user.
You are cheating and complicating the actual problem by putting double-quotes around the value of num
. There is a problem regardless. Open a support ticket but do not expect that anything will be done to make it work.
@takaakinakajima
It's hard to have it in SLP but you can try it by creating a custom command by writing basic mathematical operations. I have tried it with python. Maybe it will help you. Below are basic workaround what I did with python.
>>> a=123456789123456789123456789123456789123456789123456789123456789123456789123456789
>>> b=123456789123456789123456789123456789123456789123456789123456789123456789123456790
>>> c=a+b
>>> c
246913578246913578246913578246913578246913578246913578246913578246913578246913579L
Happy Splunking