MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / abs

Method abs

code/mathematics/intx.cpp:57–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55 intx operator -() const {
56 intx res(*this); res.sign *= -1; return res; }
57 friend intx abs(const intx &n) { return n < 0 ? -n : n; }
58 intx operator +(const intx& b) const {
59 if (sign > 0 && b.sign < 0) return *this - (-b);
60 if (sign < 0 && b.sign > 0) return b - (-*this);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected