public function mod($mod)
    {
        self::mustBeNumeric($mod, 'Divisor');

        if ($mod instanceof N) {
            $mod = $mod->double;
        }

        if ($mod == 0) {
            throw new \InvalidArgumentException('Cannot divide by 0!');
        }

        return new N(fmod($this->value, $mod));
    }
public function mod($mod)
    {
        self::mustBeNumeric($mod, 'Divisor');

        if ($mod instanceof N) {
            $mod = $mod->double;
        }

        if ($mod == 0) {
            throw new \InvalidArgumentException('Cannot divide by 0!');
        }

        return new N(fmod($this->value, $mod));
    }
public function mod ( $ mod ) { self :: mustBeNumeric ( $ mod , 'Divisor' ) ; if ( $ mod instanceof N ) { $ mod = $ mod -> double ; } if ( $ mod == 0 ) { throw new \ InvalidArgumentException ( 'Cannot divide by 0!' ) ; } return new N ( fmod ( $ this -> value , $ mod ) ) ; }
Computes modulo of current number

Computes modulo of current number using given number as divisor. Unlike
`mod()` function, this can use integer or float value, into primitive
PHP type or into `\Malenki\Bah\N` object.

Example:

$n = new N(2001);
echo $n->mod(5); // '1';
echo $n->mod(3); // '0'

@see N::modulo() Alias method
@param int|float|double|N $mod Divisor as an integer/float/double-like
value
@return N
@throws \InvalidArgumentException If given number is not valid type
@throws \InvalidArgumentException If given number is zero
Computes modulo of current number