float_power

Contents

float_power#

class saiunit.math.float_power(x, y, **kwargs)#

First array elements raised to powers from second array, element-wise.

Like power(), but integers, float16, and float32 are promoted to floats with a minimum precision of float64 so that the result is always inexact. The exponent must be dimensionless.

Parameters:
  • x (saiunit.Quantity | Array | ndarray | bool | number | bool | int | float | complex) – The bases.

  • y (Array | ndarray | bool | number | bool | int | float | complex) – The exponents. Must be dimensionless if a Quantity. If x.shape != y.shape, they must be broadcastable to a common shape.

Returns:

out – The bases in x raised to the exponents in y. This is a scalar if both x and y are scalars. The resulting unit is x.unit ** y.

Return type:

saiunit.Quantity | Array

Raises:

TypeError – If y is a Quantity that is not dimensionless.

Examples

>>> import saiunit as u
>>> q = u.math.array([2.0, 3.0]) * u.meter
>>> u.math.float_power(q, 2)  # unit is meter ** 2