Text to number conversion of large numbers - Grasshopper2024-03-29T00:41:39Zhttps://www.grasshopper3d.com/forum/topics/text-to-number-conversion-of-large-numbers?commentId=2985220%3AComment%3A1497636&x=1&feed=yes&xn_auth=noThanks!
However, I need to f…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14976362016-03-31T15:36:27.754ZLudvig Haavhttps://www.grasshopper3d.com/profile/LudvigNyman
<p>Thanks!</p>
<p></p>
<p>However, I need to feed the large number to Octopus, which only listens to the number component. So in my specific case im better off doing a pre split and post merge work around.<br/><br/>I will save this for reference though..</p>
<p>Thanks!</p>
<p></p>
<p>However, I need to feed the large number to Octopus, which only listens to the number component. So in my specific case im better off doing a pre split and post merge work around.<br/><br/>I will save this for reference though..</p> Thanks for your sharing, very…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14975622016-03-31T15:30:06.369ZRémy Maurcothttps://www.grasshopper3d.com/profile/Remy
<p>Thanks for your sharing, very cool !</p>
<p>Thanks for your sharing, very cool !</p> Sorry, I forgot to attach the…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14973992016-03-31T15:15:36.629ZMahdiyarhttps://www.grasshopper3d.com/profile/Mahdiyar
<p>Sorry, I forgot to attach the example file.</p>
<p>Sorry, I forgot to attach the example file.</p> As David mentioned, you can u…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14977102016-03-31T15:12:13.912ZMahdiyarhttps://www.grasshopper3d.com/profile/Mahdiyar
<p>As David mentioned, you can use "<a href="https://msdn.microsoft.com/en-us/library/system.numerics.biginteger%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396" rel="nofollow" target="_blank">BigInteger</a>" data type in C# to work with <span>arbitrarily large signed integer. It's not complicated (at least for simple mathematical processes). here is an screenshot:…</span></p>
<p></p>
<p>As David mentioned, you can use "<a rel="nofollow" href="https://msdn.microsoft.com/en-us/library/system.numerics.biginteger%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396" target="_blank">BigInteger</a>" data type in C# to work with <span>arbitrarily large signed integer. It's not complicated (at least for simple mathematical processes). here is an screenshot:</span></p>
<p><span><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769132342?profile=original" target="_self"><img width="721" src="http://storage.ning.com/topology/rest/1.0/file/get/2769132342?profile=RESIZE_1024x1024" width="721" class="align-full"/></a></span></p>
<p><span>To work with "BigInteger" data type you must add "System.Numerics.dll" as an assembly to your C# component. It's easy, just right-click on the C# component, select "Manage Assemblies...", and then click on the "add" link to specify the location of "System.Numerics.dll" on your computer.</span></p>
<p></p>
<p><span><a href="http://storage.ning.com/topology/rest/1.0/file/get/2769132661?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2769132661?profile=original" width="317" class="align-full"/></a>Here I've attached the dll file and a very simple example.</span></p>
<p></p> Oh, thanks to the three of yo…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14976252016-03-31T14:55:56.940ZLudvig Haavhttps://www.grasshopper3d.com/profile/LudvigNyman
<p>Oh, thanks to the three of you that is. Very thorough response indeed! Hope it serves more ppl as well.</p>
<p>Oh, thanks to the three of you that is. Very thorough response indeed! Hope it serves more ppl as well.</p> Thanks to the both of you for…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14975052016-03-31T14:32:01.843ZLudvig Haavhttps://www.grasshopper3d.com/profile/LudvigNyman
<p>Thanks to the both of you for fast response. I will need to work around it by splitting it up then.<br/><br/>The reason for such a large number is because it im mapping the UV position of 5 windows on walls. Each window is created from two points in its wall UV space. Each point needs 4 digits. That is eight digits per window. It just adds up... :(</p>
<p>Ahh soo much data management.. :/</p>
<p>Thanks to the both of you for fast response. I will need to work around it by splitting it up then.<br/><br/>The reason for such a large number is because it im mapping the UV position of 5 windows on walls. Each window is created from two points in its wall UV space. Each point needs 4 digits. That is eight digits per window. It just adds up... :(</p>
<p>Ahh soo much data management.. :/</p> Grasshopper use Double Precis…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14976152016-03-31T14:19:06.474ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Grasshopper use Double Precision Floating Point numbers for anything requiring decimals, the upper limit of 'doubles' is about 10^300 which is way bigger than your numbers here. However doubles are based on scientific notation which means you get about 16 decimal places to play with. So if you convert a very large integer 10505151515052515051015200005201505052015 into a double it will take the first 16 digits and turn it into 1.0505151515052515 * 10^40. that's why you're getting all those…</p>
<p>Grasshopper use Double Precision Floating Point numbers for anything requiring decimals, the upper limit of 'doubles' is about 10^300 which is way bigger than your numbers here. However doubles are based on scientific notation which means you get about 16 decimal places to play with. So if you convert a very large integer 10505151515052515051015200005201505052015 into a double it will take the first 16 digits and turn it into 1.0505151515052515 * 10^40. that's why you're getting all those zeroes. For big numbers like this, the distance between two adjacent double values can be much bigger than 1.0</p>
<p></p>
<p>When dealing with integers, Grasshopper uses 32-bit signed integers, that go from roughly -2billion to +2billion. That's clearly much too small to contain your value.</p>
<p></p>
<p>You will either need to stick to strings or switch to arbitrary sized integers. This requires custom coding in Python, or possibly C#.</p> Hi Ludvig, check here: Data T…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14973932016-03-31T14:10:40.270ZPieter Segerenhttps://www.grasshopper3d.com/profile/Pieter
<p>Hi Ludvig, <br/>check here: <br/><a href="https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx" target="_blank">Data Type Ranges</a></p>
<p>Hi Ludvig, <br/>check here: <br/><a href="https://msdn.microsoft.com/en-us/library/s3f49ktz.aspx" target="_blank">Data Type Ranges</a></p> The problem is, that numbers…tag:www.grasshopper3d.com,2016-03-31:2985220:Comment:14974912016-03-31T14:09:17.286ZArmin Seltzhttps://www.grasshopper3d.com/profile/ArminSeltz
<p>The problem is, that numbers work differently to text, which can be almost infinitely long. Numbers can't. If GH is using 64bit numbers, then longest number you can have is <span>2 ^ 63 - 1 or 9,223,372,036,854,775,807 ie. a number that is 19 digits long.</span></p>
<p>Since GH is displaying numbers by default with the .0 at the end, I would say that removes 2 digits giving a maximum of 17 digits. Right now it seems to "break" the conversion after the 16th digit. So, close…</p>
<p>The problem is, that numbers work differently to text, which can be almost infinitely long. Numbers can't. If GH is using 64bit numbers, then longest number you can have is <span>2 ^ 63 - 1 or 9,223,372,036,854,775,807 ie. a number that is 19 digits long.</span></p>
<p>Since GH is displaying numbers by default with the .0 at the end, I would say that removes 2 digits giving a maximum of 17 digits. Right now it seems to "break" the conversion after the 16th digit. So, close enough. </p>
<p>This is still partly speculation, but makes sense.</p>
<p>But the real question would be why you need to identify more than 9 quintillion objects!? Are you trying to recreate the universe in GH? ;)</p>