Okay, I feel stupid asking this, but I have a question about a basic
function, mod.
My ported computations from CC become all wrong if I use Perl's built-in
% operator. After a few trial and errors, it seemed like when CC mentions
R = N mod M
it's actually computing a fractional number. For
On Thu, 23 Oct 2003, Daisuke Maki wrote:
Okay, I feel stupid asking this, but I have a question about a basic
function, mod.
My ported computations from CC become all wrong if I use Perl's built-in
% operator. After a few trial and errors, it seemed like when CC mentions
R = N mod M
Yitzchak Scott-Thoennes wrote:
If you want to avoid use POSIX, floor is pretty easy:
sub floor { int($_[0]) - ( int($_[0]) $_[0] ) }
There's also lots of floor/ceil/round/nearest type functionality in
Math::Round that might be of interest: