MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / type operator/=

Method type operator/=

extern/boost/boost/rational.hpp:314–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

312 }
313 template <class T>
314 BOOST_CXX14_CONSTEXPR typename boost::enable_if_c<rational_detail::is_compatible_integer<T, IntType>::value, rational&>::type operator/= (const T& i)
315 {
316 // Avoid repeated construction
317 IntType const zero(0);
318
319 if(i == zero) BOOST_THROW_EXCEPTION(bad_rational());
320 if(num == zero) return *this;
321
322 // Avoid overflow and preserve normalization
323 IntType const gcd = integer::gcd(num, static_cast<IntType>(i));
324 num /= gcd;
325 den *= i / gcd;
326
327 if(den < zero) {
328 num = -num;
329 den = -den;
330 }
331
332 return *this;
333 }
334
335 // Increment and decrement
336 BOOST_CXX14_CONSTEXPR const rational& operator++() { num += den; return *this; }

Callers

nothing calls this directly

Calls 2

bad_rationalClass · 0.85
gcdFunction · 0.70

Tested by

no test coverage detected