semf
semf::DivideWithRound Class Reference

Class that divides 2 integers with a correct rounding. If the result has a remainder (decimal) less than .5, it will be down rounded (result is the quotient); otherwise it will be up rounded (result is quotient + 1). More...

#include <dividewithround.h>

Collaboration diagram for semf::DivideWithRound:
Collaboration graph

Static Public Member Functions

static intmax_t divide (intmax_t dividend, intmax_t divisor)
 Divides 2 integers with the right rounding. More...
 

Detailed Description

Class that divides 2 integers with a correct rounding. If the result has a remainder (decimal) less than .5, it will be down rounded (result is the quotient); otherwise it will be up rounded (result is quotient + 1).

Definition at line 22 of file dividewithround.h.

Member Function Documentation

◆ divide()

intmax_t semf::DivideWithRound::divide ( intmax_t  dividend,
intmax_t  divisor 
)
static

Divides 2 integers with the right rounding.

Parameters
dividendThe number which we divide is called the dividend.
divisorThe number by which we divide is called the divisor.
Returns
Quotient if the remainder less than .5, otherwise quotient + 1.

Definition at line 14 of file dividewithround.cpp.