libsbml-draw
src
include
sign_mag.h
Go to the documentation of this file.
1
/* MIT License
2
*/
3
4
//== FILEDOC =========================================================================
5
10
//== BEGINNING OF CODE ===============================================================
11
12
#ifndef __SBNW_SIGN_MAG_H_
13
#define __SBNW_SIGN_MAG_H_
14
15
//== INCLUDES ========================================================================
16
17
#include "
SagittariusCore.h
"
18
19
//-- C++ code --
20
#ifdef __cplusplus
21
22
namespace
LibsbmlDraw {
23
24
inline
Real
sign(
const
Real
x) {
25
//the easy way: return x == 0 ? 0 : x / mag(x);
26
if
(x > 0.)
27
return
1.;
28
else
if
(x == 0.)
29
return
0.;
30
else
31
return
-1.;
32
}
33
34
inline
Real
mag(
const
Real
x) {
35
return
(x < 0.) ? -x : x;
36
}
37
38
}
39
40
#endif
41
42
#endif
Real
SAGITTARIUS_REAL Real
Make Real visible to C. Consider letting Real lie in top namespace.
Definition:
SagittariusCommon.h:112
SagittariusCore.h
First file included.
Generated on Tue Jul 2 2019 15:58:54 for libsbml-draw by
1.8.15