Files
XCSDD/docs/api/math/h/epsilon.md
ssdfasd 58a83f445a fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling
- Improve link styling with underline decoration
- Hide leaf nodes from tree, only show directories
- Fix log file path for packaged app
2026-03-19 12:44:08 +08:00

24 lines
645 B
Markdown

# Math::EPSILON
```cpp
constexpr float EPSILON = 1e-6f;
```
`EPSILON` 是一个非常小的浮点数常量,值为 0.000001。该常量主要用于浮点数比较,由于浮点数精度问题,直接使用 `==` 比较浮点数可能产生错误结果,此时应使用 `EPSILON` 进行容差比较。例如判断两个浮点数是否相等,可以检查它们的差的绝对值是否小于 `EPSILON`
**示例:**
```cpp
#include <XCEngine/Math/Math.h>
float a = 0.1f + 0.2f;
float b = 0.3f;
if (Math::Abs(a - b) < Math::EPSILON) {
// a 和 b 可以视为相等
}
```
## 相关文档
- [Math 总览](h.md) - 返回 Math 概览