Input: a rational number $q$.
Output: an integer
Given a rational number $\frac{a}{b}$, assumed to be in lowest terms, describe an algorithm for writing this rational number in the form $n + \frac{c}{b}$ where $0 \leq c < b$ when the rational number is positive, and in the form $n - \frac{c}{b}$ when the rational number is negative.
Input: a rational number $q$.
Output: an integer
Write an algorithm for finding the floor of a rational number; that is, the greatest integer less than or equal to the given rational number.
Input: a rational number $q$.
Output: an integer
Write an algorithm for finding the ceiling of a rational number; that is, the smallest integer greater than or equal to the given rational number.
Input: a rational number $q$.
Output: an integer
Write an algorith to truncate a rational number; that is, the closest integer in absolute value that falls between $0$ and the given rational number.
Input: a rational number $q$.
Output: an integer
Write an algorithm to round a rational number; that is find the closest integer. If two integers are equally close, round to the closest even integer.
Given a non-zero real number in scientific notation in the form $m.mmm\cdots \times 10^e$, this number represenents $n$ significant digits if there are $n - 1$ digits in the mantissa ($.mmm\cdots$). Alternatively, the digits $m.mmm\cdots$ are also described as the significand, and the real number has $n$ significant digits if there are $n$ digits in the significand $m.mmm\cdots$.
Input: a real number $x$ in its decimal form.
Output: an integer