JSON中的Infinity是否比1e309更简洁? [英] Is there is a more concise representation of Infinity in JSON than 1e309?

查看:348
本文介绍了JSON中的Infinity是否比1e309更简洁?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

JSON RFC(

ietf.org/html/rfc4627rel =nofollow> http://tools.ietf.org/html/rfc4627
)指出NaN,Positive Infinity和Negative Infinity不能用JSON表示:


不允许以数字序列(例如Infinity和NaN)表示的数字值。
blockquote>

我不知道从哪里得到1 * 10 ^ 309,因为Javascript的最大确切整数值是2 ^ 53。

当你说简洁时,你的意思是简洁吗?

It's the smallest I could find.

解决方案

The JSON RFC ( http://tools.ietf.org/html/rfc4627 ) states that NaN, Positive Infinity and Negative Infinity cannot be represented in JSON:

Numeric values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted.

I don't know where you're getting 1*10^309 from, because Javascript's maximum exact integer value is 2^53.

When you say "concise" do you actually mean "succinct"?

这篇关于JSON中的Infinity是否比1e309更简洁?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆