focus expression text field at startup -> version 1.2
[LeanCalc.git] / help / hnrmod
1 NAME
2     hnrmod - compute mod h * 2^n +r
3
4 SYNOPSIS
5     hnrmod(v, h, n, r)
6
7 TYPES
8     v           integer
9     h           integer
10     n           integer
11     r           integer
12
13     return      integer
14
15 DESCRIPTION
16     Compute the value:
17
18         v % (h * 2^n +r)
19
20     where:
21
22         h > 0
23         n > 0
24         r == -1, 0 or 1
25
26     This builtin in faster than the standard mod in that is makes use
27     of shifts and additions when h == 1.  When h > 1, a division by h
28     is also needed.
29
30 EXAMPLE
31     > print hnrmod(2^177-1, 1, 177, -1), hnrmod(10^40, 17, 51, 1)
32     0 33827019788296445
33
34 LIMITS
35     h > 0
36     2^31 > n > 0
37     r == -1, 0 or 1
38
39 LINK LIBRARY
40     void zhnrmod(ZVALUE v, ZVALUE h, ZVALUE zn, ZVALUE zr, ZVALUE *res)
41
42 SEE ALSO
43     mod
44