OpenPit C++ SDK
C++17 SDK for the OpenPit pre-trade risk engine
openpit::param::Decimal Struct Reference

Exact decimal represented as mantissa * 10^-scale. More...

Public Member Functions

constexpr bool operator!= (const Decimal &other) const noexcept
 
constexpr bool operator== (const Decimal &other) const noexcept
 

Public Attributes

std::int64_t mantissaHi = 0
 Sign-extended high word of the two's-complement mantissa. More...
 
std::int64_t mantissaLo = 0
 Low signed word of the two's-complement mantissa. More...
 
std::int32_t scale = 0
 Number of base-10 fractional digits. More...
 

Detailed Description

Exact decimal represented as mantissa * 10^-scale.

The signed 128-bit mantissa is split into low and sign-extended high words so the value remains lossless without requiring a compiler-specific integer type in the public API.

Member Function Documentation

◆ operator!=()

constexpr bool openpit::param::Decimal::operator!= ( const Decimal other) const
inlineconstexprnoexcept

◆ operator==()

constexpr bool openpit::param::Decimal::operator== ( const Decimal other) const
inlineconstexprnoexcept

Member Data Documentation

◆ mantissaHi

std::int64_t openpit::param::Decimal::mantissaHi = 0

Sign-extended high word of the two's-complement mantissa.

◆ mantissaLo

std::int64_t openpit::param::Decimal::mantissaLo = 0

Low signed word of the two's-complement mantissa.

◆ scale

std::int32_t openpit::param::Decimal::scale = 0

Number of base-10 fractional digits.