nextafter#
- ivy.nextafter(x1, x2, /, *, out=None)[source]#
Return the next floating-point value after x1 towards x2, element-wise.
- Parameters:
- Return type:
bool
- Returns:
ret – The next representable values of x1 in the direction of x2.
Examples
>>> x1 = ivy.array([1.0e-50, 2.0e+50]) >>> x2 = ivy.array([2.0, 1.0]) >>> ivy.nextafter(x1, x2) ivy.array([1.4013e-45., 3.4028e+38])
- Array.nextafter(self, x2, /, *, out=None)[source]#
ivy.Array instance method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
self (
Array
) – First input array.x2 (
Array
) – Second input array.out (
Optional
[Array
], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Array
- Returns:
ret – The next representable values of x1 in the direction of x2.
Examples
>>> x1 = ivy.array([1.0e-50, 2.0e+50]) >>> x2 = ivy.array([2.0, 1.0]) >>> x1.nextafter(x2) ivy.array([1.4013e-45., 3.4028e+38])
- Container.nextafter(self, x2, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#
ivy.Container instance method variant of ivy.nextafter. This method simply wraps the function, and so the docstring for ivy.nextafter also applies to this method with minimal changes.
- Parameters:
self (
Container
) – Input container containing first input array.x2 (
Container
) – Input container containing second input array.key_chains (
Optional
[Union
[List
[str
],Dict
[str
,str
],Container
]], default:None
) – The key-chains to apply or not apply the method to. Default isNone
.to_apply (
Union
[bool
,Container
], default:True
) – If True, the method will be applied to key_chains, otherwise key_chains will be skipped. Default isTrue
.prune_unapplied (
Union
[bool
,Container
], default:False
) – Whether to prune key_chains for which the function was not applied. Default isFalse
.map_sequences (
Union
[bool
,Container
], default:False
) – Whether to also map method to sequences (lists, tuples). Default isFalse
.out (
Optional
[Container
], default:None
) – Alternate output array in which to place the result. The default is None.
- Return type:
Container
- Returns:
ret – container including the next representable values of input container’s arrays, element-wise
Examples
>>> x1 = ivy.Container(a=ivy.array([1.0e-50, 2.0e+50]), ... b=ivy.array([2.0, 1.0]) >>> x2 = ivy.Container(a=ivy.array([5.5e-30]), ... b=ivy.array([-2.0])) >>> x1.nextafter(x2) { a: ivy.array([1.4013e-45., 3.4028e+38]), b: ivy.array([5.5e-30]) }