You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
491 B

// mod().
// General includes.
#include "cl_sysdep.h"
// Specification.
#include "cln/real.h"
// Implementation.
#include "cl_R.h"
#include "cln/integer.h"
namespace cln {
const cl_R mod (const cl_R& x, const cl_R& y)
{
// Methode:
// Beides Integers -> mod(x,y).
// Sonst: floor2(x/y) -> (q,r). Liefere x-y*q=y*r.
if (integerp(x))
if (integerp(y)) {
DeclareType(cl_I,x);
DeclareType(cl_I,y);
return mod(x,y);
}
return y * floor2(x/y).remainder;
}
} // namespace cln