PetscRealConstant#

a compile time macro that ensures a given constant real number is properly represented in the configured precision of PetscReal be it half, single, double or 128-bit representation

Synopsis#

#include <petscmath.h>
PetscReal PetscRealConstant(real_number)

Not Collective

Input Parameter#

  • v1 - the real number, for example 1.5

Note#

For example, if PETSc is configured with --with-precision=__float128 and one writes

   PetscReal d = 1.5;

the result is 1.5 in double precision extended to 128 bit representation, meaning it is very far from the correct value. Hence, one should write

See Also#

PetscReal

Level#

beginner

Location#

include/petscmath.h


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