fix: improve floating-point precision handling in bernstein function#1388
fix: improve floating-point precision handling in bernstein function#1388
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Tip 🧪 Unit Test Generation v2 is now available!We have significantly improved our unit test generation capabilities. To enable: Add this to your reviews:
finishing_touches:
unit_tests:
enabled: trueTry it out by using the Have feedback? Share your thoughts on our Discord thread! Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
问题:
部分 GPU(如 Adreno 740)在边界计算时产生微小浮点误差,
导致顶点被错误判定为越界。
解决方案:
使用 clamp() 容忍浮点精度误差,并添加参数有效性检查。
之前:
// ❌ 不处理(假设精度完美)
if(t > 1.0) return 0.0; // 1.0000002 会被拒绝
现在:
// ✅ 处理(容忍精度误差)
t = clamp(t, 0.0, 1.0); // 1.0000002 修正为 1.0
if(k < 0 || k > n) return 0.0;