开发者

64bit int differences between .NET and javascript

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜