MOOSE - Multiscale Object Oriented Simulation Environment
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
doubleEq.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
** This program is part of 'MOOSE', the
3
** Messaging Object Oriented Simulation Environment.
4
** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
5
** It is made available under the terms of the
6
** GNU Lesser General Public License version 2.1
7
** See the file COPYING.LIB for the full notice.
8
**********************************************************************/
9
10
#define EPS1 1e-6
11
#define EPS2 1e-12
12
#define EPS3 1e-3
13
14
#include <math.h>
15
16
bool
doubleEq
(
double
x,
double
y )
17
{
18
double
denom = fabs( x ) + fabs( y );
19
if
( denom <
EPS2
)
20
denom =
EPS1
;
21
return
( fabs( x - y ) / denom ) <
EPS1
;
22
}
23
24
bool
doubleApprox
(
double
x,
double
y )
25
{
26
double
denom = fabs( x ) + fabs( y );
27
if
( denom <
EPS1
)
28
denom =
EPS1
;
29
return
( fabs( x - y ) / denom ) <
EPS3
;
30
}
EPS3
#define EPS3
Definition:
doubleEq.cpp:12
EPS1
#define EPS1
Definition:
doubleEq.cpp:10
doubleApprox
bool doubleApprox(double x, double y)
Definition:
doubleEq.cpp:24
doubleEq
bool doubleEq(double x, double y)
Definition:
doubleEq.cpp:16
EPS2
#define EPS2
Definition:
doubleEq.cpp:11
moose-core
basecode
doubleEq.cpp
Generated on Tue Sep 4 2018 09:05:31 for MOOSE - Multiscale Object Oriented Simulation Environment by
1.8.6