FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
moose-core/basecode/doubleEq.cpp at master · BhallaLab/moose-core · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
BhallaLab
/
moose-core
Public
Notifications
You must be signed in to change notification settings
Fork
38
Star
19
Code
Issues
47
Pull requests
2
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
moose-core
/
basecode
/
doubleEq.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (26 loc) · 844 Bytes
Breadcrumbs
moose-core
/
basecode
/
doubleEq.cpp
Copy path
File metadata and controls
30 lines (26 loc) · 844 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
*********************************************************************
** This program is part of 'MOOSE', the
** Messaging Object Oriented Simulation Environment.
** Copyright (C) 2003-2010 Upinder S. Bhalla. and NCBS
** It is made available under the terms of the
** GNU Lesser General Public License version 2.1
** See the file COPYING.LIB for the full notice.
*********************************************************************
*/
#
define
EPS1
1e-6
#
define
EPS2
1e-12
#
define
EPS3
1e-3
#
include
<
math.h
>
bool
doubleEq
(
double
x,
double
y )
{
double
denom =
fabs
( x ) +
fabs
( y );
if
( denom <
EPS2
)
denom =
EPS1
;
return
(
fabs
( x - y ) / denom ) <
EPS1
;
}
bool
doubleApprox
(
double
x,
double
y )
{
double
denom =
fabs
( x ) +
fabs
( y );
if
( denom <
EPS1
)
denom =
EPS1
;
return
(
fabs
( x - y ) / denom ) <
EPS3
;
}
Back
|
FazBrowse Home
|
New Git URL