Thunderbots Project
Loading...
Searching...
No Matches
geom_constants.h
1#pragma once
2
3// Due to the internal representation of doubles, comparing them to zero using ULPs
4// does not make sense. Instead, we have to pick some fixed epsilon to compare doubles
5// to zero. We pick 1e-15, which is approximately 10 ULPs near 1.0, and should fit the
6// needs of operations near such scale. This is not meant to cover all use cases, and
7// other epsilon values may need to be chosen for specific use cases.
8// Further reading: https://bitbashing.io/comparing-floats.html
9static constexpr double FIXED_EPSILON = 1e-15;
10
11// A single double arithmetic operation with accurate inputs can have a maximum error
12// of 0.5 ULP. These errors accumulate with successive operations, and the appropriate
13// max ULPs value should be chosen based on the specific use case.
14// Further reading: https://bitbashing.io/comparing-floats.html
15static constexpr int ULPS_EPSILON_TEN = 10;
16static constexpr int ULPS_EPSILON_HUNDRED = 100;