PetscApproximateGTE — PETSc 3.21.4 documentation

Skip to main content
`Ctrl`+`K`

# PetscApproximateGTE

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

## Synopsis

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

Not Collective

## Input Parameters

- x - the variable

- b - the constant float it is checking if `x` is greater 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 (PetscApproximateGTE(x, 3.2)) {  // replaces if (x >= 3.2) {

## See Also

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

## Level

advanced

## Location

include/petscmath.h

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