fix#
- ivy.fix(x, /, *, out=None)[source]#
Round an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats.
- Parameters:
- Return type:
- Returns:
ret – Array of floats with elements corresponding to input elements rounded to nearest integer towards zero, element-wise.
Examples
>>> x = ivy.array([2.1, 2.9, -2.1]) >>> ivy.fix(x) ivy.array([ 2., 2., -2.])
- Array.fix(self, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
self (
Array
) – Array input.out (
Optional
[Array
], default:None
) – optional output array, for writing the result to.
- Return type:
Array
- Returns:
ret – Array of floats with elements corresponding to input elements rounded to nearest integer towards zero, element-wise.
Examples
>>> x = ivy.array([2.1, 2.9, -2.1]) >>> x.fix() ivy.array([ 2., 2., -2.])
- Container.fix(self, /, *, out=None)[source]#
ivy.Container instance method variant of ivy.fix. This method simply wraps the function, and so the docstring for ivy.fix also applies to this method with minimal changes.
- Parameters:
self (
Container
) – input container with array items.out (
Optional
[Container
], default:None
) – optional output container, for writing the result to.
- Return type:
Container
- Returns:
ret – Container including arrays with element-wise rounding of input arrays elements.
Examples
>>> x = ivy.Container(a=ivy.array([2.1, 2.9, -2.1]), b=ivy.array([3.14])) >>> x.fix() { a: ivy.array([ 2., 2., -2.]) b: ivy.array([ 3.0 ]) }