www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/RemAfterDivisionForFloatingPointValuesExample.m

    %% Remainder After Division for Floating-Point Values
% Find the remainder after division for several angles using a divisor of
% |2*pi|. When possible, |rem| attempts to produce exact integer
% results by comepensating for floating-point round-off effects.
theta = [0.0 3.5 5.9 6.2 9.0 4*pi];
b = 2*pi;
r = rem(theta,b)