System.Math.EnsureRange

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function EnsureRange(const AValue, AMin, AMax: Integer): Integer;
function EnsureRange(const AValue, AMin, AMax: Int64): Int64;
function EnsureRange(const AValue, AMin, AMax: UInt64): UInt64;
function EnsureRange(const AValue, AMin, AMax: Single): Single;
function EnsureRange(const AValue, AMin, AMax: Double): Double;
function EnsureRange(const AValue, AMin, AMax: Extended): Extended;

C++

extern DELPHI_PACKAGE int __fastcall EnsureRange(const int AValue, const int AMin, const int AMax)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.Math.pas
System.Math.hpp
System.Math System.Math

Description

Returns the closest value to a specified value within a specified range.

EnsureRange returns a value that is guaranteed to be within a specified range.

AValue is the value you want as long as it is in range. If AValue is in range, EnsureRange returns AValue.

AMin is the minimum acceptable value. If AValue is less than AMin, EnsureRange returns AMin.

AMax is the maximum acceptable value. If AValue is greater than AMax, EnsureRange returns AMax.

See Also