Next / Previous / Contents / TCC Help System / NM Tech homepage

6.4. Intrinsics for numbers

By intrinsics we mean built-in functions of Python. These functions operate on all the different kinds of numbers:

abs(x)

Returns the absolute value of x. For complex values, returns the magnitude.

coerce(a,b)

Returns a tuple (a',b') of the arguments coerced to the same type.

divmod(a,b)

Returns a tuple (q, r) where q is the quotient a/b and r is the remainder a%b.

pow(x,y[,z])

Computes x to the y power. If the optional third argument is given, it computes (x**y)%z.

round(x)

Returns x rounded up or down to the nearest integral float, e.g., round(-3.5) yields -4.

For common transcendental functions like square root and logarithm, see the math module below.