What uses do floating point NaN payloads have?

回眸只為那壹抹淺笑 提交于 2019-11-28 11:11:41

It was thought to be a good idea whenIEEE754 and NaN's were developed. I have actually seen it used to store the reason why a NaN was created.

Today, I wouldn't use it in portable code for several reasons. How sure are you that this payload will survive for example an assignment? If you assign x = y, how sure are you that x has the same NaN payload as y? And how sure are you that it will survive arithmetic? If a or b is an NaN, then a op b is supposed to be the one NaN, or one of the two NaNs if they are both NaN. Sure that this is the case? I wouldn't be willing to bet on it.

Dan Heidinga

https://softwareengineering.stackexchange.com/questions/185406/what-is-the-purpose-of-nan-boxing

Take a look at that link for an explanation of how js engines use nan boxing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!