Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我的 glsl 顶点着色器中,假设我有以下代码:
float len = k/0;
现在 len 是无穷大。如果我将它乘以 0 会发生什么?结果是保持“无穷大”还是变为0?换句话说,如果无穷大乘以 0 会发生什么?数学上应该是0...
在数学上,它没有明确定义,因为无穷大没有明确定义(至少在正常数系中)。inf*0在符合 IEEE-754 的系统上的输出(我认为GLSL 保证,也许除了非规范化?)是 NaN。
inf*0
有关各种操作对各种特殊浮点值的影响的更多信息,请参见此处。