确定NSNumber是否为NaN

编程入门 行业动态 更新时间:2024-10-21 13:07:05
本文介绍了确定NSNumber是否为NaN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何确定Cocoa NSNumber是否代表NaN(不是数字)?

例如,当我解析一个无效的字符串因此,我发现类属性 [NSDecimalNumber notANumber] 只是为了这个目的。在某些语言中,NaN!= NaN,但在Cocoa中不是这样。

How can I determine if a Cocoa NSNumber represents NaN (not a number)?

This emerges, for example, when I parse a string that has an invalid (non-numeric) contents.

解决方案

So, I found out that the class property [NSDecimalNumber notANumber] is just for this purpose. In some languages NaN != NaN, but this isn't the case in Cocoa.

更多推荐

确定NSNumber是否为NaN

本文发布于:2023-11-29 17:17:10,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1647067.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:NSNumber   NaN

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!