Skip to main content
`Ctrl`+`K`

# PetscApproximateLTE

Performs a less than or equal to on a given constant with a fudge for floating point numbers

## Synopsis

    #include <petscmath.h>
    bool PetscApproximateLTE(PetscReal x,constant float)

Not Collective

## Input Parameters

- x - the variable

- b - the constant float it is checking if `x` is less than or equal to

## Notes

The fudge factor is the value `PETSC_SMALL`

The constant numerical value is automatically set to the appropriate precision of PETSc so can just be provided as, for example, 3.2

This is used in several examples for setting initial conditions based on coordinate values that are computed with i*h that produces inexact floating point results.

Example:

      PetscReal x;
      if (PetscApproximateLTE(x, 3.2)) { // replaces if (x <= 3.2) {

## See Also

`PetscMax()`, `PetscMin()`, `PetscAbsInt()`, `PetscAbsReal()`, `PetscApproximateGTE()`

## Level

advanced

## Location

include/petscmath.h

Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages