Skip to content

Minor improvement for the documentation of ulp and ulpOfOne. #23211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions stdlib/public/core/FloatingPoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,25 @@ public protocol FloatingPoint : SignedNumeric, Strideable, Hashable
/// - `greatestFiniteMagnitude.ulp` is a finite number, even though the next
/// greater representable value is `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.
/// See also the `ulpOfOne` static property.
var ulp: Self { get }

/// The unit in the last place of 1.0.
///
/// The positive difference between 1.0 and the next greater representable
/// number. The `ulpOfOne` constant corresponds to the C macros
/// `FLT_EPSILON`, `DBL_EPSILON`, and others with a similar purpose.
/// number. `ulpOfOne` corresponds to the value represented by the C macros
/// `FLT_EPSILON`, `DBL_EPSILON`, etc, and is sometimes called *epsilon* or
/// *machine epsilon*. Swift deliberately avoids using the term "epsilon"
/// because:
///
/// - Historically "epsilon" has been used to refer to several different
/// concepts in different languages, leading to confusion and bugs.
///
/// - The name "epsilon" suggests that this quantity is a good tolerance to
/// choose for approximate comparisons, but it is almost always unsuitable
/// for that purpose.
///
/// See also the `ulp` member property.
static var ulpOfOne: Self { get }

/// The least positive normal number.
Expand Down