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 (
Union[saiunit.Quantity,Array,ndarray,number,bool]) – The bases.y (
Array|ndarray|number|bool) – The exponents. Must be dimensionless if a Quantity. Ifx.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:
Union[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