==================================================================== Single Integer ==================================================================== The SingleInteger domain is intended to provide support in FriCAS for machine integer arithmetic. It is generally much faster than (bignum) Integer arithmetic but suffers from a limited range of values. Since FriCAS can be implemented on top of various dialects of Lisp, the actual representation of small integers may not correspond exactly to the host machines integer representation. You can discover the minimum and maximum values in your implementation by using min and max. :: min()$SingleInteger - 2147483648 Type: SingleInteger max()$SingleInteger 2147483647 Type: SingleInteger To avoid confusion with Integer, which is the default type for integers, you usually need to work with declared variables. :: a := 1234 :: SingleInteger 1234 Type: SingleInteger or use package calling :: b := 124$SingleInteger 124 Type: SingleInteger You can add, multiply and subtract SingleInteger objects, and ask for the greatest common divisor (gcd). :: gcd(a,b) 2 Type: SingleInteger The least common multiple (lcm) is also available. :: lcm(a,b) 76508 Type: SingleInteger Operations mulmod, addmod, submod, and invmod are similar - they provide arithmetic modulo a given small integer. Here is 5 * 6 mod 13. :: mulmod(5,6,13)$SingleInteger 4 Type: SingleInteger To reduce a small integer modulo a prime, use positiveRemainder. :: positiveRemainder(37,13)$SingleInteger 11 Type: SingleInteger Operations And, Or, xor, and Not provide bit level operations on small integers. :: And(3,4)$SingleInteger 0 Type: SingleInteger Use shift(int,numToShift) to shift bits, where i is shifted left if numToShift is positive, right if negative. :: shift(1,4)$SingleInteger 16 Type: SingleInteger shift(31,-1)$SingleInteger 15 Type: SingleInteger Many other operations are available for small integers, including many of those provided for Integer. See Also: * )help Integer * )show SingleInteger