Large number to string is not working

Step 1: log LargeNumberToString(1000000000000000000000000000) to the console

It logs 1e+27

1 Like

Any progress on this? IDK if I’m reading this correctly but it looks like ToString and LargeNumberToString are using the same function.

GDJS/GDJS/Extensions/Builtin/CommonConversionsExtension.cpp
C++
·
master
  GetAllStrExpressions()["ToString"].SetFunctionName("gdjs.evtTools.common.toString");
  GetAllStrExpressions()["LargeNumberToString"].SetFunctionName("gdjs.evtTools.common.toString");

https://github.com/search?q=repo%3A4ian%2FGDevelop%20LargeNumberToString&type=code

it looks like ToString and LargeNumberToString are using the same function.

That’s the case indeed.

@Reborn, what are you trying to achieve? Relying on such a big number is usually not very safe in any computer environment.

A while ago because of some requests I made an extension that format numbers (example: 1000000 becomes 1,000,000) New extension: Format Number by github-actions[bot] · Pull Request #1112 · GDevelopApp/GDevelop-extensions · GitHub

But, it breaks after 1 septillion because gdevelop automatically formats the input to scientific notation.

I think this may be past the maximum number supported in Javascript? If so, it never makes it to the expression to begin converting it.

1 Like