开发者

64bit int differences between .NET and javascript

开发者 https://www.devze.com 2023-02-01 03:35 出处:网络
I\'m passing a long int from C# (DateTime.Now().Ticks) to a web page then trying to pass it back for the sake of concurrency.

I'm passing a long int from C# (DateTime.Now().Ticks) to a web page then trying to pass it back for the sake of concurrency.

634290758865783994 becomes 634290758865783900

Why is this? I t开发者_高级运维hought both the System.Long and Javascript Number were 64 bit integers.


ECMAScript (the formal name for javascript) stores numbers as IEEE-754 double precision floating-points.

These can only represent the values up to 2^53 using the significant bits, and everything above this will be an approximation.

0

精彩评论

暂无评论...
验证码 换一张
取 消