<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problems with tonumber convertion - always returns the same value in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175853#M50509</link>
    <description>&lt;P&gt;Being slightly pedantic here, but what's actually happening is that &lt;CODE&gt;6,021,001,100,101,010,952,552,448&lt;/CODE&gt; is the most accurate IEEE754 Double representation - for &lt;STRONG&gt;all&lt;/STRONG&gt; of your input serial numbers. The small differences between them are beyond what a Double can distinguish.&lt;/P&gt;

&lt;P&gt;For comparison, the next bigger Double with no other values between them would be &lt;CODE&gt;6,021,001,100,101,012,026,294,272&lt;/CODE&gt; - about a billion higher.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Aug 2014 18:40:42 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-08-08T18:40:42Z</dc:date>
    <item>
      <title>Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175848#M50504</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;while doing some field comparisons I had problems matching one number field to another. After some research into my data I got the strange phenomena that converting my field to a number always leads to the same result.&lt;BR /&gt;
My input value is already numerical but if a apply the following search:&lt;/P&gt;

&lt;P&gt;sourcetype=systemevents eventTyp=PT0001 | eval number=tonumber(seriennummerZentral)   | eval  string=tostring(seriennummerZentral) | table seriennummerZentral number string&lt;/P&gt;

&lt;P&gt;I get:&lt;/P&gt;

&lt;P&gt;seriennummerZentral↕       number↕                          string↕&lt;BR /&gt;&lt;BR /&gt;
06021001100101011000001492 6021001100101010952552448.000000 06021001100101011000001492 &lt;BR /&gt;
06021001100101011000001492 6021001100101010952552448.000000 06021001100101011000001492 &lt;BR /&gt;
06021001100101011000001492 6021001100101010952552448.000000 06021001100101011000001492 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;BR /&gt;
06021001100101011000001451 6021001100101010952552448.000000 06021001100101011000001451 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;BR /&gt;
06021001100101011000001451 6021001100101010952552448.000000 06021001100101011000001451 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;BR /&gt;
06021001100101011000001451 6021001100101010952552448.000000 06021001100101011000001451 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;BR /&gt;
06021001100101011000001487 6021001100101010952552448.000000 06021001100101011000001487 &lt;/P&gt;

&lt;P&gt;seriennummerZentral is changing as is string but number is always the same&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 09:35:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175848#M50504</guid>
      <dc:creator>ChrisLH</dc:creator>
      <dc:date>2014-08-08T09:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175849#M50505</link>
      <description>&lt;P&gt;I guess that you've hit the limit of integers when converting to number. Do you have any specific need for the conversion?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 11:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175849#M50505</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-08T11:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175850#M50506</link>
      <description>&lt;P&gt;I wanted to select events by comparing two number fields: &lt;BR /&gt;
seriennummerZentral seriennummerFzg&lt;BR /&gt;
with the search statement:&lt;/P&gt;

&lt;P&gt;sourcetype=systemevents eventTyp=PT0001  | where seriennummerZentral=seriennummerFzg&lt;/P&gt;

&lt;P&gt;and got only positve results no matter the values. I figured it's maybe a problem with data types and tryed converting to number and to string. &lt;BR /&gt;
| where tostring (seriennummerZentral) = tostring (seriennummerFzg) &lt;BR /&gt;
is working&lt;BR /&gt;
| where tonumber (seriennummerZentral) = tonumber (seriennummerFzg) &lt;BR /&gt;
gives the same results as the initial statement, always true&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 12:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175850#M50506</guid>
      <dc:creator>ChrisLH</dc:creator>
      <dc:date>2014-08-08T12:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175851#M50507</link>
      <description>&lt;P&gt;I believe you won't be doing any numeric operation on the Serial No fields, you should use it as string (with conversion if required).&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 12:40:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175851#M50507</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-08-08T12:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175852#M50508</link>
      <description>&lt;P&gt;yeaa, you're probably right &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
and I think the problem was the integer limit.&lt;BR /&gt;
Thx !&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 12:48:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175852#M50508</guid>
      <dc:creator>ChrisLH</dc:creator>
      <dc:date>2014-08-08T12:48:27Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with tonumber convertion - always returns the same value</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175853#M50509</link>
      <description>&lt;P&gt;Being slightly pedantic here, but what's actually happening is that &lt;CODE&gt;6,021,001,100,101,010,952,552,448&lt;/CODE&gt; is the most accurate IEEE754 Double representation - for &lt;STRONG&gt;all&lt;/STRONG&gt; of your input serial numbers. The small differences between them are beyond what a Double can distinguish.&lt;/P&gt;

&lt;P&gt;For comparison, the next bigger Double with no other values between them would be &lt;CODE&gt;6,021,001,100,101,012,026,294,272&lt;/CODE&gt; - about a billion higher.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Aug 2014 18:40:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Problems-with-tonumber-convertion-always-returns-the-same-value/m-p/175853#M50509</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-08-08T18:40:42Z</dc:date>
    </item>
  </channel>
</rss>

