Movatterモバイル変換


[0]ホーム

URL:


SciPy

numpy.spacing

numpy.spacing(x,/,out=None,*,where=True,casting='same_kind',order='K',dtype=None,subok=True[,signature,extobj]) = <ufunc 'spacing'>

Return the distance between x and the nearest adjacent number.

Parameters:
x:array_like

Values to find the spacing of.

out:ndarray, None, or tuple of ndarray and None, optional

A location into which the result is stored. If provided, it must havea shape that the inputs broadcast to. If not provided orNone,a freshly-allocated array is returned. A tuple (possible only as akeyword argument) must have length equal to the number of outputs.

where:array_like, optional

Values of True indicate to calculate the ufunc at that position, valuesof False indicate to leave the value in the output alone.

**kwargs

For other keyword-only arguments, see theufunc docs.

Returns:
out:ndarray or scalar

The spacing of values ofx.This is a scalar ifx is a scalar.

Notes

It can be considered as a generalization of EPS:spacing(np.float64(1))==np.finfo(np.float64).eps, and thereshould not be any representable number betweenx+spacing(x) andx for any finite x.

Spacing of +- inf and NaN is NaN.

Examples

>>>np.spacing(1)==np.finfo(np.float64).epsTrue

Previous topic

numpy.nextafter

Next topic

numpy.lcm

Quick search

  • © Copyright 2008-2018, The SciPy community.
  • Last updated on Jul 24, 2018.
  • Created usingSphinx 1.6.6.

[8]ページ先頭

©2009-2025 Movatter.jp