System.Math.EnsureRange
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 */;
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
function | public | System.Math.pas System.Math.hpp |
System.Math | System.Math |
Description
Renvoie la valeur la plus proche de la valeur spécifiée, dans l'intervalle indiqué.
EnsureRange renvoie une valeur qui est garantie appartenir à un intervalle donné.
AValue est la valeur que vous voulez si elle appartient à l'intervalle. Si AValue est dans la plage, EnsureRange renvoie AValue.
AMin est la valeur acceptable minimale. Si AValue est inférieure à AMin, EnsureRange renvoie AMin.
AMax est la valeur acceptable maximale. Si AValue est supérieur à AMax, EnsureRange renvoie AMax.