MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Div

Method Div

extern/ttmath/ttmathint.h:479–501  ·  view source on GitHub ↗

! division this = this / ss2 returned values: 0 - ok 1 - division by zero for example: (result means 'this') 20 / 3 --> result: 6 remainder: 2 -20 / 3 --> result: -6 remainder: -2 20 / -3 --> result: -6 remainder: 2 -20 / -3 --> result: 6 remainder: -2 in other words: this(old) = ss2 * this(new)(result) + remainder */

Source from the content-addressed store, hash-verified

477 in other words: this(old) = ss2 * this(new)(result) + remainder
478 */
479 uint Div(Int<value_size> ss2, Int<value_size> * remainder = 0)
480 {
481 bool ss1_is_sign, ss2_is_sign;
482
483 ss1_is_sign = IsSign();
484 ss2_is_sign = ss2.IsSign();
485
486 /*
487 we don't have to test the carry from Abs as well as in Mul
488 */
489 Abs();
490 ss2.Abs();
491
492 uint c = UInt<value_size>::Div(ss2, remainder);
493
494 if( ss1_is_sign != ss2_is_sign )
495 SetSign();
496
497 if( ss1_is_sign && remainder )
498 remainder->SetSign();
499
500 return c;
501 }
502
503 uint Div(const Int<value_size> & ss2, Int<value_size> & remainder)
504 {

Callers 15

Sin0pi05Function · 0.45
ASin_0Function · 0.45
ASin_1Function · 0.45
ATan0Function · 0.45
ATan01Function · 0.45
ATanGreaterThanPlusOneFunction · 0.45
TanhFunction · 0.45
CothFunction · 0.45
ATanhFunction · 0.45
ACothFunction · 0.45
DegToRadFunction · 0.45
RadToDegFunction · 0.45

Calls 4

AbsFunction · 0.85
IsSignMethod · 0.80
AbsMethod · 0.80
SetSignMethod · 0.80

Tested by

no test coverage detected