Float

[align=center][size=large]Float jdk-1.8[/size][/align]

一、isNan()

1.源码

/**
* Returns <code>true</code> if the specified number is a
* Not-a-Number (NaN) value, <code>false</code> otherwise.
*
* @param v the value to be tested.
* @return <code>true</code> if the argument is NaN;
* <code>false</code> otherwise.
*/
static public boolean isNaN(float v) {
return (v != v);
}


判断一个 float 是否一个 number

2.分析
存在一些 float 类型数据,在编译期间为 float ,但在运行期则不是

// 0 不能为除数 ,此时认为 该参数为非number ,即 Nan
// 而 Nan != Nan 为TRUE ;
// 而 其他Number 之间, val != val 为false
Float.isNaN(0.0f / 0.0f); // true
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值