Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# numpy.nextafter

All Samples(59)  |  Call(59)  |  Derive(0)  |  Import(0)
```nextafter(x1, x2[, out])

Return the next floating-point value after x1 towards x2, element-wise.

Parameters
----------
x1 : array_like
Values to find the next representable value of.
x2 : array_like
The direction where to look for the next representable value of `x1`.(more...)
```

```        if xa.dtype.char in np.typecodes['Float']:
# Treat 1.0 as slightly less than 1.
xa.dtype.type(0)))
# The following clip is fast, and prevents possible
```

```        if xa.dtype.char in np.typecodes['Float']:
# Treat 1.0 as slightly less than 1.
xa.dtype.type(0)))
# The following clip is fast, and prevents possible
```

```        else:
# return int(PyNextAfter(x, x - 1))
return int(numpy.nextafter(x, x - 1))
else:
if isinstance(x, int):
return x + 1
else:
# return int(PyNextAfter(x,x + 1)) + 1
return int(numpy.nextafter(x, x + 1)) + 1
```
```    elif dtype.kind == "f":
if direction < 0:
return numpy.nextafter(x, x - 1)
else:
return numpy.nextafter(x, x + 1)
```

```        else:
# return int(PyNextAfter(x, x - 1))
return int(numpy.nextafter(x, x - 1))
else:
if isinstance(x, int):
return x + 1
else:
# return int(PyNextAfter(x,x + 1)) + 1
return int(numpy.nextafter(x, x + 1)) + 1
```
```    elif dtype.kind == "f":
if direction < 0:
return numpy.nextafter(x, x - 1)
else:
return numpy.nextafter(x, x + 1)
```

```            # skip it as it does not represent a class increment
continue
last_max = numpy.nextafter(quantity, sys.float_info.max)
new_styles.append(style_class)
return new_styles
```

```            if value == numpy.finfo(datatype).max:
return numpy.inf
return numpy.nextafter(datatype(value), datatype(numpy.inf))

else:
```

```            # Treat 1.0 as slightly less than 1.
vals = np.array([1, 0], dtype=xa.dtype)
almost_one = np.nextafter(*vals)
# The following clip is fast, and prevents possible
```

```        assert_equal(np.spacing(a_f16[:-1]), a_f16[1:]-a_f16[:-1])

assert_equal(np.nextafter(a_f16[:-1], hinf), a_f16[1:])
assert_equal(np.nextafter(a_f16[0], -hinf), -a_f16[1])
assert_equal(np.nextafter(a_f16[1:], -hinf), a_f16[:-1])
```
```        assert_equal(np.spacing(a_f16[1:]), a_f16[:-1]-a_f16[1:])

assert_equal(np.nextafter(a_f16[0], hinf), -a_f16[1])
assert_equal(np.nextafter(a_f16[1:], hinf), a_f16[:-1])
assert_equal(np.nextafter(a_f16[:-1], -hinf), a_f16[1:])
```

```        assert_equal(np.spacing(a_f16[:-1]), a_f16[1:]-a_f16[:-1])

assert_equal(np.nextafter(a_f16[:-1], hinf), a_f16[1:])
assert_equal(np.nextafter(a_f16[0], -hinf), -a_f16[1])
assert_equal(np.nextafter(a_f16[1:], -hinf), a_f16[:-1])
```
```        assert_equal(np.spacing(a_f16[1:]), a_f16[:-1]-a_f16[1:])

assert_equal(np.nextafter(a_f16[0], hinf), -a_f16[1])
assert_equal(np.nextafter(a_f16[1:], hinf), a_f16[:-1])
assert_equal(np.nextafter(a_f16[:-1], -hinf), a_f16[1:])
```

```    zero = t(0)