56 {
57 if (location >= 0) {
58 if (distance > std::numeric_limits<SI>::max() - location) {
59 return std::numeric_limits<SI>::max();
60 }
61 } else if (distance < std::numeric_limits<SI>::min() - location) {
62 return std::numeric_limits<SI>::min();
63 }
65}
66
69}
70
72 if (upper >= 0) {
73 if (lower < 0 && upper > std::numeric_limits<SI>::max() + lower) {
74 return std::numeric_limits<SI>::max();
75 }
76 } else if (lower > 0 && upper < std::numeric_limits<SI>::min() + lower) {
77 return std::numeric_limits<SI>::min();
78 }
80}
81
84}
85
87
88
89 return static_cast<Scalar>(std::scalbn(
a, -1) + std::scalbn(
b, -1));
90}
91
93
94
95
96
97
98
99
100
101
102
103
104
105 return static_cast<Scalar>(std::scalbn(
a, -1) + std::scalbn(
b, -1));
106}
107
109 return v;
110}
111
113 if (v <=
static_cast<FP>(std::numeric_limits<SI>::min())) {
114 return std::numeric_limits<SI>::min();
115 }
else if (v >=
static_cast<FP>(std::numeric_limits<SI>::max())) {
116 return std::numeric_limits<SI>::max();
117 }
118 return static_cast<SI>(v);
119}
120
122 if (std::isfinite(v)) {
123
124 return std::clamp(static_cast<FP2>(v),
125 std::numeric_limits<FP2>::lowest(),
126 std::numeric_limits<FP2>::max());
127 } else {
128 return static_cast<FP2>(v);
129 }
130}
131
132#undef ONLY_ON_SAME_TYPES
133#undef ONLY_ON_SAME_TYPES_RET
134#undef ONLY_ON_DIFFERING_FLOAT
135#undef ONLY_ON_DIFFERING_FLOAT_RET
136#undef ONLY_ON_FLOAT_TO_SIGNED_INT
137#undef ONLY_ON_FLOAT_TO_SIGNED_INT_RET
138#undef ONLY_ON_FLOAT
139#undef ONLY_ON_FLOAT_RET
140#undef ONLY_ON_SIGNED_INT
141#undef ONLY_ON_SIGNED_INT_RET
142
143}
144
145}
146
147#endif
#define ONLY_ON_FLOAT_TO_SIGNED_INT(FPType, SIType)
#define ONLY_ON_FLOAT(Type)
#define ONLY_ON_SIGNED_INT(Type)
#define ONLY_ON_SIGNED_INT_RET(Type, Ret)
#define ONLY_ON_SAME_TYPES(Type1, Type2)
#define ONLY_ON_DIFFERING_FLOAT(FPType1, FPType2)