Pecunia 0.9.0-alpha.22
Library using the ISO-4217 currency standard & a fixed monetary unit size
Loading...
Searching...
No Matches
pecunia::rounders::reals Namespace Reference

Functions

PECUNIA_EXPORT FloatingPoint down (const FloatingPoint &number, const std::uint8_t &digitsLeft)
 Performs a rounding operation using the round-half down towards -∞ method.
 
PECUNIA_EXPORT FloatingPoint even (const FloatingPoint &number, const std::uint8_t &digitsLeft)
 Performs a rounding operation using the round-half to even method.
 
PECUNIA_EXPORT FloatingPoint none (const FloatingPoint &number, const std::uint8_t &digitsLeft)
 Performs no rounding operation.
 
PECUNIA_EXPORT FloatingPoint odd (const FloatingPoint &number, const std::uint8_t &digitsLeft)
 Performs a rounding operation using the round-half to odd method.
 
PECUNIA_EXPORT FloatingPoint up (const FloatingPoint &number, const std::uint8_t &digitsLeft)
 Performs a rounding operation using the round-half up towards +∞ method.
 

Function Documentation

◆ down()

PECUNIA_EXPORT FloatingPoint pecunia::rounders::reals::down ( const FloatingPoint & number,
const std::uint8_t & digitsLeft )
nodiscard

Performs a rounding operation using the round-half down towards -∞ method.

Parameters
numberThe floating-point number to round.
digitsLeftThe number of digits left after rounding the number to the right of the decimal point.
Returns
The rounded number with the correct number of digits.

◆ even()

PECUNIA_EXPORT FloatingPoint pecunia::rounders::reals::even ( const FloatingPoint & number,
const std::uint8_t & digitsLeft )
nodiscard

Performs a rounding operation using the round-half to even method.

Parameters
numberThe floating-point number to round.
digitsLeftThe number of digits left after rounding the number to the right of the decimal point.
Returns
The rounded number with the correct number of digits.

◆ none()

PECUNIA_EXPORT FloatingPoint pecunia::rounders::reals::none ( const FloatingPoint & number,
const std::uint8_t & digitsLeft )
nodiscard

Performs no rounding operation.

Parameters
numberThe floating-point number to round using none changing method.
digitsLeftIgnored.
Returns
The rounded number as supplied.

◆ odd()

PECUNIA_EXPORT FloatingPoint pecunia::rounders::reals::odd ( const FloatingPoint & number,
const std::uint8_t & digitsLeft )
nodiscard

Performs a rounding operation using the round-half to odd method.

Parameters
numberThe floating-point number to round.
digitsLeftThe number of digits left after rounding the number to the right of the decimal point.
Returns
The rounded number with the correct number of digits.

◆ up()

PECUNIA_EXPORT FloatingPoint pecunia::rounders::reals::up ( const FloatingPoint & number,
const std::uint8_t & digitsLeft )
nodiscard

Performs a rounding operation using the round-half up towards +∞ method.

Parameters
numberThe floating-point number to round.
digitsLeftThe number of digits left after rounding the number to the right of the decimal point.
Returns
The rounded number with the correct number of digits.