deg2rad

array_api_extra.deg2rad(x, /, *, xp=None)

Convert angles from degrees to radians.

Parameters:
  • x (object) – Input array in degrees. Must have an integral or floating-point dtype.

  • xp (ModuleType | None) – The standard-compatible namespace for x. Default: infer.

Returns:

The corresponding angles in radians. Integral inputs are converted to the default floating-point dtype.

Return type:

object

Examples

>>> import array_api_strict as xp
>>> import array_api_extra as xpx
>>> xpx.deg2rad(xp.asarray([0, 90, 180]), xp=xp)
Array([0.        , 1.57079633, 3.14159265], dtype=array_api_strict.float64)