Rounding and remainder functions with negative inputs

Some of MATLAB's rounding and remainder functions, such as fix and floor or rem and mod, agree for positive inputs but can differ when a negative number is involved. Enter the value MATLAB returns for each expression in the table below. Every result is an exact integer, so type it as an integer with its sign where needed.

ExpressionResult
round(-2.5)
fix(-2.7)
floor(-2.7)
ceil(-2.7)
rem(-7,3)
mod(-7,3)

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Introduction to MATLAB Software Questions: