Eclipse SUMO - Simulation of Urban MObility
StdDefs.cpp
Go to the documentation of this file.
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3
// Copyright (C) 2014-2019 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials
5
// are made available under the terms of the Eclipse Public License v2.0
6
// which accompanies this distribution, and is available at
7
// http://www.eclipse.org/legal/epl-v20.html
8
// SPDX-License-Identifier: EPL-2.0
9
/****************************************************************************/
17
/****************************************************************************/
18
19
20
// ===========================================================================
21
// included modules
22
// ===========================================================================
23
#include "
StdDefs.h
"
24
25
26
// set by option --precision (see SystemFrame.cpp)
27
int
gPrecision
= 2;
28
int
gPrecisionGeo
= 6;
29
bool
gHumanReadableTime
=
false
;
30
bool
gSimulation
=
false
;
31
double
gWeightsRandomFactor
= 1;
32
33
bool
gDebugFlag1
=
false
;
34
bool
gDebugFlag2
=
false
;
35
bool
gDebugFlag3
=
false
;
36
bool
gDebugFlag4
=
false
;
37
38
double
truncate
(
double
x,
int
fractionBits) {
39
return
ceil(x * (1 << fractionBits)) / (1 << fractionBits);
40
}
41
42
double
roundBits
(
double
x,
int
fractionBits) {
43
const
double
x2 = x * (1 << fractionBits);
44
const
double
rounded = x2 < 0 ? ceil(x2 - 0.5) : floor(x2 + 0.5);
45
return
rounded / (1 << fractionBits);
46
}
47
48
/****************************************************************************/
49
roundBits
double roundBits(double x, int fractionBits)
round to the given number of mantissa bits beyond the given number
Definition:
StdDefs.cpp:42
gSimulation
bool gSimulation
Definition:
StdDefs.cpp:30
gPrecisionGeo
int gPrecisionGeo
Definition:
StdDefs.cpp:28
gWeightsRandomFactor
double gWeightsRandomFactor
Definition:
StdDefs.cpp:31
gDebugFlag3
bool gDebugFlag3
Definition:
StdDefs.cpp:35
truncate
double truncate(double x, int fractionBits)
discrds mantissa bits beyond the given number
Definition:
StdDefs.cpp:38
gHumanReadableTime
bool gHumanReadableTime
Definition:
StdDefs.cpp:29
gDebugFlag4
bool gDebugFlag4
Definition:
StdDefs.cpp:36
gDebugFlag2
bool gDebugFlag2
Definition:
StdDefs.cpp:34
gDebugFlag1
bool gDebugFlag1
global utility flags for debugging
Definition:
StdDefs.cpp:33
gPrecision
int gPrecision
the precision for floating point outputs
Definition:
StdDefs.cpp:27
StdDefs.h
src
utils
common
StdDefs.cpp
Generated on Wed Jan 15 2020 15:04:13 for Eclipse SUMO - Simulation of Urban MObility by
1.8.16