Owl Embedded Python for 32-bit Microcontrollers

Main page
Library Reference
Owl License


These math functions are direct maps to the C floating-point math library. They accept either floats or ints and return floats as the result.


Returns the arc cosine of x, in radians.


Returns the arc sine of x, in radians.


Returns the arc tangent of x, in radians.

atan2(y, x)

Returns atan(y / x), in radians. The result is between -pi and pi. The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis. The key feature of atan2() is that the signs of both inputs are known to it, so it can compute the correct quadrant for the angle. For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.


Returns the cosine of x, in radians.


Converts the angle r from radians to degrees.


Returns the absolute value of x.

hypot(x, y)

Returns the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y).


Returns a tuple containing two elements: the fractional and integer parts of x, respectively. Both elements carry the sign of x and are floats.

pow(x, y)

Returns x raised to the power y. Exceptional cases follow the schema of the C compiler used to build the VM. On the Cortex-M, pow(1.0, x) and pow(x, 0.0) always return 1.0, even when x is a zero or a NaN.


Converts angle d from degrees to radians.


Returns the sine of x, in radians.


Returns the square root of x. Returns floating-point infinity if x is negative.


Returns the tangent of x, in radians.