What leads to the floating point exception “1.#IO”

≯℡__Kan透↙ 提交于 2019-12-13 02:36:46

问题


I'm debugging a simulation with many calculations in many Fortran files. I am used to seeing some floating point exceptions (-1.#QNB or 1.#QNAN) for errors that involve division by zero or operations that exceed the maximum size for floating point number. I'm assuming -1.#IO means invalid operation, but I'm not sure mathematically what would cause this and not QNB or QNAN or QINF.

What would lead to the exception -1.#IO?


回答1:


According to the IEEE 754 Standard for Floating Point Operations, the invalid operation is signaled

when a NaN or infinite operand cannot be represented in the destination format and this cannot otherwise be indicated [...] When a numeric operand would convert to an integer outside the range of the destination format, the invalid operation exception shall be signaled if this situation cannot otherwise be indicated.

This page gives a few examples:

  • zero * infinity
  • zero / zero
  • infinity / infinity
  • square root of a negative operand
  • [and a few more]


来源:https://stackoverflow.com/questions/35997187/what-leads-to-the-floating-point-exception-1-io

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