All Subjects

Floor division

Definition

Floor division is an operation that divides two numbers and returns the largest integer less than or equal to the result. In Python, it is performed using the // operator.

5 Must Know Facts For Your Next Test

  1. The floor division operator in Python is //.
  2. Floor division always rounds down to the nearest whole number.
  3. When both operands are integers, the result of floor division is an integer.
  4. When at least one operand is a float, the result of floor division is a float.
  5. Floor division can be used with both positive and negative numbers, following the rule of rounding towards minus infinity.

Review Questions

  • What operator is used for floor division in Python?
  • How does floor division handle the result when dividing two numbers?
  • What type of value (integer or float) does floor division return when one of the operands is a float?

"Floor division" appears in:

Related terms

Division: An arithmetic operation that calculates how many times one number can be contained within another.

Modulo: An arithmetic operation that returns the remainder after division of one number by another.

// Operator: The symbol used in Python to perform floor division.



© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.

AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.