MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / pow

Method pow

src/Base/Unit.cpp:212–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212Unit Unit::pow(const double exp) const
213{
214 auto apply = [&](const auto val) {
215 const auto num {val * exp};
216 if (std::fabs(std::round(num) - num) >= std::numeric_limits<double>::epsilon()) {
217 throw UnitsMismatchError("pow() of unit not possible");
218 }
219
220 return static_cast<decltype(val)>(val * exp);
221 };
222
223 UnitExponents res {};
224 std::transform(_exps.begin(), _exps.end(), res.begin(), apply);
225
226 return Unit {res};
227}
228
229UnitExponents Unit::exponents() const
230{

Callers 10

getQuantityMethod · 0.45
evaluateMethod · 0.45
yyparseFunction · 0.45
number_power_handlerMethod · 0.45
equilibriumMethod · 0.45
setUpMethod · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 3

transformFunction · 0.50
beginMethod · 0.45
endMethod · 0.45

Tested by 1

setUpMethod · 0.36