0

I am using the following setup. - Backend Entity framework V4 - Controller ASP.NET MCV - FrontEnd Typescript with Knockout JS

I am creating a incremental game like cookie clicker, and clicker heroes. Where you get income and more money constantly.

However now i am in the following issue the max size of a double is: 1.7976931348623157E+308 (https://msdn.microsoft.com/en-us/library/system.double.maxvalue(v=vs.110).aspx)

And the max size of a number in Javscript is: 1.7976931348623157e+308 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_VALUE

But i want to store, show and calculate with numbers bigger then that. I tried looking at the BigInteger class but EF does not know how to store that.

Also i would not know how to intergrate that with typescript. I looked further but could not find any framework or class fitting my problem? Is there something for this, or do i need to build something from scratch?

matthy
  • 8,144
  • 10
  • 38
  • 47
  • 1
    Search for "BigInt" and similar libraries. See [this question and its answers](https://stackoverflow.com/q/4557509/215552). – Heretic Monkey Mar 21 '18 at 20:35
  • Lucky escape with double... at that size it would have caused problems anyway. Somewhat unintuitively `(1.0e+100 + 1) == 1.0e+100` is `true`. Hmm... – spender Mar 21 '18 at 20:38
  • @MikeMcCaughan yes that would solve the problem for the JS part, however not the EF / C# part – matthy Mar 22 '18 at 12:38
  • Actually, searching for bigint for .NET/C# yields https://stackoverflow.com/q/176775/215552 and https://stackoverflow.com/q/279038/215552 – Heretic Monkey Mar 22 '18 at 21:21
  • sorry for the late reply, i found this, but cant seem to find how to intergrate that in the EF (Entity framework V4) when i make a property with type of BigInteger it wont make a field for in the Database – matthy Apr 13 '18 at 14:23

0 Answers0