xref: /petsc/src/sys/utils/matheq.c (revision 750b007cd8d816cecd9de99077bb0a703b4cf61a)
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   return (a == b) ? PETSC_TRUE : PETSC_FALSE;
21 }
22 
23 /*@C
24     PetscEqualScalar - Returns whether the two scalar values are equal.
25 
26     Input Parameters:
27 +     a - first scalar value
28 -     b - second scalar value
29 
30     Note:
31     Equivalent to "a == b". Should be used to prevent compilers from
32     emitting floating point comparison warnings (e.g. GCC's -Wfloat-equal flag)
33     in PETSc header files or user code.
34 
35     Level: developer
36 
37 .seealso: `PetscIsCloseAtTol()`, `PetscEqualReal()`
38 @*/
39 PetscBool PetscEqualScalar(PetscScalar a, PetscScalar b) {
40   return (a == b) ? PETSC_TRUE : PETSC_FALSE;
41 }
42