MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / shared

Method shared

libraries/FLE/FLE.cpp:167–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165
166
167FLE FLE::shared(FLE a)
168{
169 float v, e;
170 // six possible cases.
171 // case 1, 6
172 if ((*this < a) || (*this > a)) return FLE(NAN, NAN); // no overlap
173
174 // case 3, 4
175 if (a.in(*this)) return a;
176 if (this->in(a)) return *this;
177
178 // case 2
179 if (low() < a.low())
180 {
181 v = (a.low() + high())/2;
182 e = v - a.low();
183 }
184 // case 5
185 else
186 {
187 v = (low() + a.high())/2;
188 e = v - low();
189 }
190 return FLE(v, e);
191}
192
193
194FLE FLE::lower(FLE a)

Callers 1

unittestFunction · 0.80

Calls 4

inMethod · 0.95
FLEClass · 0.85
lowMethod · 0.45
highMethod · 0.45

Tested by 1

unittestFunction · 0.64