The unit in the last place of this value.
SDK
- Xcode 8.0+
Framework
- Swift Standard Library
Declaration
var ulp: Double { get }
Discussion
This is the unit of the least significant digit in this value’s significand. For most numbers x, this is the difference between x and the next greater (in magnitude) representable number. There are some edge cases to be aware of:
If
xis not a finite number, thenxis NaN..ulp If
xis very small in magnitude, thenxmay be a subnormal number. If a type does not support subnormals,.ulp xmay be rounded to zero..ulp greatestis a finite number, even though the next greater representable value isFinite Magnitude .ulp infinity.
This quantity, or a related quantity, is sometimes called epsilon or machine epsilon. Avoid that name because it has different meanings in different languages, which can lead to confusion, and because it suggests that it is a good tolerance to use for comparisons, which it almost never is.