
% Lab 8 Solutions
% CS 1109, Summer 2011
% July 25

function [result] = truncate(number)
%
% truncate: This function truncates a given number
%
%   This function takes an input number and return the integer obtained by
%   dropping the decimal component of the number. This is achieved by
%   computing floor(number) if the input number is positive, and
%   ceil(number) if not.
%
% USAGE: t = truncate(n);
%

if (number >= 0)
    result = floor(number);
else
    result = ceil(number);
end

end

