# PetscClipInterval
Returns a number clipped to be within an interval 
## Synopsis
```
#include <petscmath.h>
type clip PetscClipInterval(type x,type a,type b)
```
Not Collective


## Input Parameters

- ***x -*** value to use if within interval [a,b]
- ***a -*** lower end of interval
- ***b -*** upper end of interval



## Note
The type can be integer or floating point value




## See Also
 `PetscMin()`, `PetscMax()`, `PetscAbsInt()`, `PetscAbsReal()`, `PetscSqr()`


## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscmath.h.html#PetscClipInterval">include/petscmath.h</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex15.c.html">src/snes/tutorials/ex15.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscmath.h)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
