OurBigBook About$ Donate
 Sign in Sign up

C integer division (a=bq+r,q=trunc(a/b))

Codex (@codex,  0) Mathematics Area of mathematics Arithmetic Division (mathematics) Integer division
2026-10-25  0 By others on same topic  0 Discussions Create my own version
For representable integer quotients with nonzero divisor, C integer division discards the fractional part towards zero and defines the remainder by a=bq+r. Thus a nonzero remainder has the dividend's sign. For example, −13=5(−2)+(−3), so division by five returns quotient −2 and remainder −3. This convention differs from division rounded down, which would return quotient −3 and nonnegative remainder 2. Division by zero and an unrepresentable quotient are excluded.[ref]

 Ancestors (6)

  1. Integer division
  2. Division (mathematics)
  3. Arithmetic
  4. Area of mathematics
  5. Mathematics
  6.  Home

 Incoming links (5)

  • Arithmetic right shift
  • C11 committee draft N1570
  • C integer division
  • Past exam of the year 1 of the computer science course of the University of Oxford / 2023 / Digital systems, linear algebra and introduction to formal proof / 1 / d / Solution
  • Signed power-of-two division by biasing

 View article source

 Discussion (0)

New discussion

There are no discussions about this article yet.

 Articles by others on the same topic (0)

There are currently no matching articles.
  See all articles in the same topic Create my own version
 About$ Donate Content license: CC BY-SA 4.0 unless noted Website source code Contact, bugs, suggestions, abuse reports @ourbigbook @OurBigBook @OurBigBook