小编JLo*_*JLo的帖子

vulkan 浮点行为问题

我尝试在 GLSL Vulkan 计算着色器中实现Alma College 的 Andrew Thall 所著的论文Extended-Precision Floating-Point Numbers for GPU Computation。我需要这个,因为我的一些设备不支持双精度。

我的问题出在 quickTwoSum 函数中

vec2 quickTwoSum( float a , float b) {
    float s = a + b;
    float t = s - a;
    float e = b - t;
    return vec2(s, e);
}
Run Code Online (Sandbox Code Playgroud)

例如

a = 114251.609
b = -0.00107500004
Run Code Online (Sandbox Code Playgroud)

然后发生这种情况

s = 114251.609 // this is correct because b is to small
t = -0.00107500004 // <= why? (s - a) …
Run Code Online (Sandbox Code Playgroud)

floating-point precision glsl vulkan

10
推荐指数
0
解决办法
446
查看次数

标签 统计

floating-point ×1

glsl ×1

precision ×1

vulkan ×1