xref: /petsc/src/sys/utils/matheq.c (revision 89928cc5142e867cb7b0dd1ff74e0acffcd6b4b5)
1 #include <petscsys.h>
2 
3 /*@C
4     PetscEqualReal - Returns whether the two real values are equal.
5 
6     Input Parameters:
7 +     a - first real number
8 -     b - second real number
9 
10     Note:
11     Equivalent to "a == b". Should be used to prevent compilers from
12     emitting floating point comparison warnings (e.g. GCC's -Wfloat-equal flag)
13     in PETSc header files or user code.
14 
15     Level: developer
16 
17 .seealso: `PetscIsCloseAtTol()`, `PetscEqualScalar()`
18 @*/
19 PetscBool PetscEqualReal(PetscReal a, PetscReal b)
20 {
21   return (a == b) ? PETSC_TRUE : PETSC_FALSE;
22 }
23 
24 /*@C
25     PetscEqualScalar - Returns whether the two scalar values are equal.
26 
27     Input Parameters:
28 +     a - first scalar value
29 -     b - second scalar value
30 
31     Note:
32     Equivalent to "a == b". Should be used to prevent compilers from
33     emitting floating point comparison warnings (e.g. GCC's -Wfloat-equal flag)
34     in PETSc header files or user code.
35 
36     Level: developer
37 
38 .seealso: `PetscIsCloseAtTol()`, `PetscEqualReal()`
39 @*/
40 PetscBool PetscEqualScalar(PetscScalar a, PetscScalar b)
41 {
42   return (a == b) ? PETSC_TRUE : PETSC_FALSE;
43 }
44