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