<!--
{
  "documentType" : "article",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/clipping-limit-and-threshold-operations",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Clipping, limit, and threshold operations"
}
-->

# Clipping, limit, and threshold operations

Apply clipping, limit, or threshold rules to the elements in a vector.

## Topics

### Clipping Operations

The functions in this group restrict the values in a vector so that they fall within a given range or invert values outside a given range.

[`static func clip<U>(U, to: ClosedRange<Double>) -> [Double]`](/documentation/Accelerate/vDSP/clip(_:to:)-8jsic)

Returns the elements of a double-precision vector clipped to the specified range.

[`static func clip<U>(U, to: ClosedRange<Float>) -> [Float]`](/documentation/Accelerate/vDSP/clip(_:to:)-20gz4)

Returns the elements of a single-precision vector clipped to the specified range.

[`static func clip<U, V>(U, to: ClosedRange<Double>, result: inout V)`](/documentation/Accelerate/vDSP/clip(_:to:result:)-3lbii)

Calculates the elements of a double-precision vector clipped to the specified range.

[`static func clip<U, V>(U, to: ClosedRange<Float>, result: inout V)`](/documentation/Accelerate/vDSP/clip(_:to:result:)-84zw9)

Calculates the elements of a single-precision vector clipped to the specified range.

[`static func invertedClip<U>(U, to: ClosedRange<Double>) -> [Double]`](/documentation/Accelerate/vDSP/invertedClip(_:to:)-8yqtl)

Returns a double-precision vector that’s inverted-clipped to the specified range.

[`static func invertedClip<U>(U, to: ClosedRange<Float>) -> [Float]`](/documentation/Accelerate/vDSP/invertedClip(_:to:)-4pkxw)

Returns a single-precision vector that’s inverted-clipped to the specified range.

[`static func invertedClip<U, V>(U, to: ClosedRange<Double>, result: inout V)`](/documentation/Accelerate/vDSP/invertedClip(_:to:result:)-5ioal)

Calculates a double-precision vector that’s inverted-clipped to the specified range.

[`static func invertedClip<U, V>(U, to: ClosedRange<Float>, result: inout V)`](/documentation/Accelerate/vDSP/invertedClip(_:to:result:)-3q12m)

Calculates a single-precision vector that’s inverted-clipped to the specified range.

[`extern void vDSP_vclip(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vclip)

Calculates the elements of a single-precision vector clipped to the specified range.

[`extern void vDSP_vclipD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vclipD)

Calculates the elements of a double-precision vector clipped to the specified range.

[`extern void vDSP_vclipc(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N, vDSP_Length *__NLow, vDSP_Length *__NHigh);`](/documentation/Accelerate/vDSP_vclipc)

Calculates and counts the elements of a single-precision vector clipped to the specified range.

[`extern void vDSP_vclipcD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N, vDSP_Length *__NLow, vDSP_Length *__NHigh);`](/documentation/Accelerate/vDSP_vclipcD)

Calculates and counts the elements of a double-precision vector clipped to the specified range.

[`extern void vDSP_viclip(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_viclip)

Calculates the elements of a single-precision vector inverted-clipped to the specified range using the specified stride.

[`extern void vDSP_viclipD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_viclipD)

Calculates the elements of a double-precision vector inverted-clipped to the specified range using the specified stride.

[`extern void vDSP_vthr(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthr)

Calculates single-precision vector threshold to the specified range.

[`extern void vDSP_vthrD(const double *__A, vDSP_Stride __IA, const double *__B, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthrD)

Calculates double-precision vector threshold to the specified range.

### Limit Operations

[`static func limit<U>(U, limit: Double, withOutputConstant: Double) -> [Double]`](/documentation/Accelerate/vDSP/limit(_:limit:withOutputConstant:)-2d9u6)

Returns the double-precision vector test limit.

[`static func limit<U>(U, limit: Float, withOutputConstant: Float) -> [Float]`](/documentation/Accelerate/vDSP/limit(_:limit:withOutputConstant:)-8bj65)

Returns the single-precision vector test limit.

[`static func limit<U, V>(U, limit: Double, withOutputConstant: Double, result: inout V)`](/documentation/Accelerate/vDSP/limit(_:limit:withOutputConstant:result:)-6apdv)

Calculates the double-precision vector test limit.

[`static func limit<U, V>(U, limit: Float, withOutputConstant: Float, result: inout V)`](/documentation/Accelerate/vDSP/limit(_:limit:withOutputConstant:result:)-9v33v)

Calculates the single-precision vector test limit.

[`extern void vDSP_vlim(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vlim)

Calculates the single-precision vector test limit using the specified stride.

[`extern void vDSP_vlimD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vlimD)

Calculates the double-precision vector test limit using the specified stride.

### Threshold Operations

[`static func threshold<U>(U, to: Double, with: vDSP.ThresholdRule<Double>) -> [Double]`](/documentation/Accelerate/vDSP/threshold(_:to:with:)-77g7l)

Returns the elements of the supplied double-precision vector after applying a specified thresholding rule.

[`static func threshold<U>(U, to: Float, with: vDSP.ThresholdRule<Float>) -> [Float]`](/documentation/Accelerate/vDSP/threshold(_:to:with:)-534ob)

Returns the elements of the supplied single-precision vector after applying a specified thresholding rule.

[`static func threshold<U, V>(U, to: Double, with: vDSP.ThresholdRule<Double>, result: inout V)`](/documentation/Accelerate/vDSP/threshold(_:to:with:result:)-45b58)

Calculates the elements of the supplied double-precision vector after applying a specified thresholding rule.

[`static func threshold<U, V>(U, to: Float, with: vDSP.ThresholdRule<Float>, result: inout V)`](/documentation/Accelerate/vDSP/threshold(_:to:with:result:)-8137c)

Calculates the elements of the supplied single-precision vector after applying a specified thresholding rule.

[`enum ThresholdRule`](/documentation/Accelerate/vDSP/ThresholdRule)

Constants that specify vector threshold rules.

[`extern void vDSP_vthres(const float *__A, vDSP_Stride __IA, const float *__B, float *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthres)

Calculates single-precision vector threshold with zero fill to the specified range.

[`extern void vDSP_vthresD(const double *__A, vDSP_Stride __IA, const double *__B, double *__C, vDSP_Stride __IC, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthresD)

Calculates double-precision vector threshold with zero fill to the specified range.

[`extern void vDSP_vthrsc(const float *__A, vDSP_Stride __IA, const float *__B, const float *__C, float *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthrsc)

Calculates single-precision vector threshold with signed constant to the specified range.

[`extern void vDSP_vthrscD(const double *__A, vDSP_Stride __IA, const double *__B, const double *__C, double *__D, vDSP_Stride __ID, vDSP_Length __N);`](/documentation/Accelerate/vDSP_vthrscD)

Calculates double-precision vector threshold with signed constant to the specified range.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)