JS_GetNaNValue 编辑
Get the not-a-number (NaN) floating-point number as a value of type JS::Value
.
Syntax
// Added in SpiderMonkey 42
JS::Value
JS_GetNaNValue(JSContext *cx);
// Obsolete since SpiderMonkey 42
jsval
JS_GetNaNValue(JSContext *cx);
Name | Type | Description |
---|---|---|
cx | JSContext * | A context. |
Description
JS_GetNaNValue
returns a value of type JS::Value
that represents an IEEE floating-point quiet Not-a-Number (NaN
).
NaN
is typically used in JavaScript as the return value of a numeric operation when an argument is invalid or conversion fails. For example, 0/0
and Math.sqrt(-1)
both return NaN
. So do Number("xyzzy")
and Math.sin("Frank")
. While the IEEE standard defines many NaN
bit-patterns, they are indistinguishable in JavaScript, so in effect there's only one NaN
.
NaN
is not equal to any other value. In fact, it is not even equal to itself: if x
is NaN
, then x != x
.
See Also
- MXR ID Search for
JS_GetNaNValue
JS_GetNegativeInfinityValue
JS_GetPositiveInfinityValue
- bug 1184564 -- Changed jsval to JS::Value
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论