semf
dividewithround.cpp
Go to the documentation of this file.
1
10
#include <
semf/utils/processing/dividewithround.h
>
11
12
namespace
semf
13
{
14
intmax_t
DivideWithRound::divide
(intmax_t dividend, intmax_t divisor)
15
{
16
intmax_t result = dividend / divisor;
17
if
(((result + 1) * divisor - dividend) < (dividend - (result * divisor)))
18
{
19
result = result + 1;
20
}
21
return
result;
22
}
23
}
/* namespace semf */
semf::DivideWithRound::divide
static intmax_t divide(intmax_t dividend, intmax_t divisor)
Divides 2 integers with the right rounding.
Definition:
dividewithround.cpp:14
dividewithround.h
semf
Definition:
batterymodelwithoutdataset.h:18
semf
utils
processing
dividewithround.cpp
Generated by
1.9.4