|
| 27 Jul 2015 09:00 PM |
Number = 104912345432191072912345432190912345432190912345432198432151234813743212347000001907349912345432190743212347591234543219074321234730000001192093912345432191912345432192912345432192912345432192912345432190912345432190912345432190912345432190912345432190912345432190
print(tonumber(Number))
>1.0491234543219e+263 -- Wut? I want the full value back :( |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:01 PM |
| print(string.format("%18.0f",Number)) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:03 PM |
Eh, probably an issue with double rounding or something along those lines. Why do you need to use tonumber on such a stupidly huge number?
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:04 PM |
| encoding parts into numbers for infinite datastores |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:06 PM |
doesn't format properly >104912345432191070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:06 PM |
Number is still that number it's just in scientific notation when tostringed.
btw tonumbering a number and then printing it was kind of useless since print just tostrings it lol.
But when you're outputting it simply use the string.format thing I gave you |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:07 PM |
I thought datastores were encoded into JSON, so what affect would this have?
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:08 PM |
Try
print(string.format("%.0f", Number)) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:08 PM |
i need to to number it since a number doesn't have a datalimit in a datastore?
Perhaps we can fenv it? Idk how |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jul 2015 09:20 PM |
My post wouldn't go through for some reason so I took a picture of it;
gyazo(DOT)com/e4d9f86c4b268f09aeb9deb1b12f4793 |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 27 Jul 2015 09:20 PM |
Data is data... datastores have a DATA limit.
Numbers are data too. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:21 PM |
| http://wiki.roblox.com/index.php?title=JSON |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 27 Jul 2015 09:21 PM |
He was calling tonumber() because he thought it'd return the full number. He didn't realize 1.0491234543219e+263 was still of the number datatype.
Yeah, sorry, there's only so much data you can fit into 64 bits, and you're going to have some floating point precision issues.
I don't know what exactly you're trying to do so no one here can give you an alternative. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:23 PM |
| You can also try to save it as a string. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 09:36 PM |
...which will accomplish nothing, because it's all converted into a string anyways ;)
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 27 Jul 2015 09:48 PM |
| If you initially make it a string it won't turn into scientific notation, which is what he meant. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 10:08 PM |
| A hacky way would be to convert to string, chop it into little pieces every 20th digit, and save it in a table. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2015 10:09 PM |
| Wait, why do you need a number so large o-o |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 28 Jul 2015 04:46 AM |
| Precision is lost, computers can't store numbers in an infinite amount of bytes. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2015 04:24 PM |
Even more fun: any integer above 2^53 (about 9 quadrillion) is not guaranteed to maintain precision, but the highest possible number (which is an integer obviously) is around 1.79e308.
Try it yourself:
print(1.7e308) --> 1.7e+308 print(1.8e308) --> 1.#INF (infinity)
~Upload code to codepad-dot-org with Lua syntax highlighting to preserve indentation and make it easier to read!~ |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 28 Jul 2015 04:47 PM |
| 53 bits of precision for IEEE-754 doubles, which is why we need Lua 5.3 for the integer datatype so we have 63/64 bits of precision for integers. Believe it or not, 11 bits more of precision makes a HUGE difference. |
|
|
| Report Abuse |
|
|