The following function calculates the fractional part of a real number x.
function y=frac_part(x) y=x-floor(x); end;