google / google/amber

be more careful about floating point comparisons

Open
#111 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
228
Forks
77
PR merge metrics
No merged PRs in 30d

Description

When comparing pixel values the absolute errors you care about is strongly determined by the image format. E.g. with 32-bit floats per colour channel, you're in the range of 2**(-23) ULP (machine epsilon for a `float`). But with an 8-bits per channel, you're in the 1/256 range.

So when doing fuzzy comparisons on pixel values you want the test case to supply the absolute error bound, probably.

When comparing errors for compute purposes, e.g. error on sin(x) you express it as ULP which is a relative error.
See
https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#spirvenv-precision-operation
and https://en.wikipedia.org/wiki/Unit_in_the_last_place

Basically, the comparison we need to make is context dependent, and controlled by the person writing the test.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.