Extracted from Pike v7.4 release 117 at 2004-11-02.
pike.ida.liu.se
[Top]
predef::

Method `%()


Method `%

mixed `%(object arg1, mixed arg2)
mixed `%(mixed arg1, object arg2)
string `%(string arg1, int arg2)
array `%(array arg1, int arg2)
float `%(float arg1, float|int arg2)
float `%(int arg1, float arg2)
int `%(int arg1, int arg2)

Description

Modulo operator.

Returns

If arg1 is an object that implements lfun::`%() then that function will be called with arg2 as the single argument.

If arg2 is an object that implements lfun::``%() then that function will be called with arg2 as the single argument.

Otherwise the result will be as follows:

arg1 can have any of the following types:
string|array

If arg2 is positive, the result will be the last `%(sizeof (arg1 ), arg2 ) elements of arg1 . If arg2 is negative, the result will be the first `%(sizeof (arg1 ), -arg2 ) elements of arg1 .

int|float

The result will be arg1  - arg2 *floor (arg1 /arg2 ). The result will be a float if either arg1 or arg2 is a float, and an int otherwise.