<?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: hextonumber not working with 64bits in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/801254#M97691</link>
    <description>&lt;P&gt;yes, we integrate python for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone for the input.&lt;/P&gt;</description>
    <pubDate>Sun, 22 Sep 2024 19:29:56 GMT</pubDate>
    <dc:creator>dadawasozo</dc:creator>
    <dc:date>2024-09-22T19:29:56Z</dc:date>
    <item>
      <title>hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800885#M97638</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have hex that is&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class=""&gt;bea000000004080bh, I tried hextonumber("bea000000004080bh"), but it is not working. Can someone help me?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 15:50:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800885#M97638</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-09-20T15:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800916#M97646</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Are you sure it is a 64-bit Hexadecimal? Including the "h" digit does not seem to conform with the standard format.&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;TS&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:01:23 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800916#M97646</guid>
      <dc:creator>Thierry_S</dc:creator>
      <dc:date>2024-09-20T18:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800919#M97647</link>
      <description>&lt;P&gt;sorry, forgot to remove the h at the end. the output raw always have h at the end to indicate hex value which we need to exclude before we do hextonumber.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the issue is it doesnt match to the number as what we expected.&lt;BR /&gt;JMP converted it as -4.768372e-7&lt;BR /&gt;&lt;BR /&gt;expected is&amp;nbsp;&lt;SPAN&gt;&lt;SPAN class=""&gt;-4710765210229274613&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dadawasozo_0-1726856176783.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/68498i2B802123A9F8C97F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dadawasozo_0-1726856176783.png" alt="dadawasozo_0-1726856176783.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I m missing?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 18:17:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800919#M97647</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-09-20T18:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800941#M97648</link>
      <description>&lt;P&gt;The value you show is signed integer and HexToNumber() returns unsigned integer.&lt;/P&gt;
&lt;P&gt;Also you need to specify the base, something like&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;a = HexToNumber("bea000000004080b",Base(16));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To get around the signed integer issue, you can use a formula like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;max = HexToNumber("7fffffffffffffff",Base(16));
a = HexToNumber("bea000000004080b",Base(16));

if( a &amp;gt; max,
	result = -(max+1) + (a-max);
, // else
	result = a;
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But then you run into another issue which is JMP cannot render a 64-bit integer value precisely.&amp;nbsp; The last two digits will get truncated and have random values.&amp;nbsp; I would recommend breaking up your 64-bit value into a upper 32-bit value, and a lower 32-bit value, and store those values in two separate columns.&amp;nbsp; Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Upper32 = HexToNumber( Left( :hex64, 8 ), Base( 16 ));&lt;BR /&gt;Lower32 = HexToNumber( Right( :hex64, 8 ), Base( 16 ));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Refer to the attached data table example.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 19:52:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800941#M97648</guid>
      <dc:creator>Mark_Zwald</dc:creator>
      <dc:date>2024-09-20T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800946#M97649</link>
      <description>&lt;P&gt;sounds like there is improvement needed for the hextonumber() why cant it do the same like the calculator do (see picture in very first post)?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;breaking down upper and lower 32 is not efficient when dealing with millions of data points. I have to process hundred of files that each contains more than 40M rows of hex value. doing the breaking down 32 will consume too much time.&lt;BR /&gt;&lt;BR /&gt;any other suggestion?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 20:47:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800946#M97649</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-09-20T20:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800948#M97650</link>
      <description>&lt;P&gt;I would use python for this.&amp;nbsp; The good news is JMP18 can run python scripts directly in JMP.&amp;nbsp; This would be the python script to do what you want:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import binascii

h = 'bea000000004080b'
b = bytes(h, 'utf-8')
ba = binascii.a2b_hex(b)
print(int.from_bytes(ba, byteorder='big', signed=True))&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As far as why JMP is limited to 17 digits of precision, that is because JMP is using float64 for numerical values.&amp;nbsp; To get more than 17 digits, JMP would need to be recompiled using float128 for numerical values, causing it to use more system memory.&amp;nbsp; If this is important, you can submit it as a feature request.&amp;nbsp; You can do that here:&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Wish-List/idb-p/jmp-wish-list" target="_blank" rel="noopener"&gt;https://community.jmp.com/t5/JMP-Wish-List/idb-p/jmp-wish-list&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 02:31:59 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800948#M97650</guid>
      <dc:creator>Mark_Zwald</dc:creator>
      <dc:date>2024-09-21T02:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800987#M97657</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/16303"&gt;@dadawasozo&lt;/a&gt; what is too much time (you have over 40 000 000 * 100 rows of data)? If you have to convert that data fast, you might have to get a bit creative (not directly related to this but interesting to read about "The One Billion Row Challenge", &lt;A href="https://github.com/gunnarmorling/1brc" target="_blank"&gt;https://github.com/gunnarmorling/1brc,&lt;/A&gt; you can also find solutions for other languages from google and there are also videos in YouTube which show and explain some solutions).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9802"&gt;@Mark_Zwald&lt;/a&gt;&amp;nbsp;When you go back to JMP is there any way of avoiding "OverflowError: Python int too large to convert to C long" outside of converting to string? Splitting the value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

hex_to_signed_int_str = function({h},
	Python Execute({h}, {x},
"\[import binascii

b = bytes(h, 'utf-8')
ba = binascii.a2b_hex(b)
x = int.from_bytes(ba, byteorder='big', signed=True)
#x = str(x)
]\");
	return(x);
);

signed_int_str = hex_to_signed_int_str("bea000000004080b");

show(signed_int_str);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Sep 2024 06:13:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/800987#M97657</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-21T06:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/801201#M97679</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;splitting the value or storing as a string would be the only way to preserve all the digits.&amp;nbsp; Any numerical value in JMP will be limited to 17digits due to the limitations of float64 variables in C++.&amp;nbsp; Apparently Python has unlimited precision in the sense that numerical values aren't limited to 64bits or 128bits, but can use as many bits as needed to store the value as long as you have the RAM to support it.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 01:13:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/801201#M97679</guid>
      <dc:creator>Mark_Zwald</dc:creator>
      <dc:date>2024-09-22T01:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: hextonumber not working with 64bits</title>
      <link>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/801254#M97691</link>
      <description>&lt;P&gt;yes, we integrate python for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks everyone for the input.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Sep 2024 19:29:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/hextonumber-not-working-with-64bits/m-p/801254#M97691</guid>
      <dc:creator>dadawasozo</dc:creator>
      <dc:date>2024-09-22T19:29:56Z</dc:date>
    </item>
  </channel>
</rss>

