20#ifndef RIPPLE_BASICS_IOUAMOUNT_H_INCLUDED
21#define RIPPLE_BASICS_IOUAMOUNT_H_INCLUDED
23#include <xrpl/basics/LocalValue.h>
24#include <xrpl/basics/Number.h>
25#include <xrpl/beast/utility/Zero.h>
27#include <boost/operators.hpp>
44class IOUAmount :
private boost::totally_ordered<IOUAmount>,
45 private boost::additive<IOUAmount>
87 operator bool() const noexcept;
115 : mantissa_(mantissa), exponent_(exponent)
132 return Number{mantissa_, exponent_};
160inline IOUAmount::operator bool() const noexcept
162 return mantissa_ != 0;
Floating point representation of amounts with high dynamic range.
IOUAmount operator-() const
int exponent() const noexcept
bool operator<(IOUAmount const &other) const
int signum() const noexcept
Return the sign of the amount.
bool operator==(IOUAmount const &other) const
void normalize()
Adjusts the mantissa and exponent to the proper range.
std::int64_t mantissa() const noexcept
IOUAmount & operator=(beast::Zero)
IOUAmount & operator+=(IOUAmount const &other)
static IOUAmount minPositiveAmount()
IOUAmount & operator-=(IOUAmount const &other)
RAII class to set and restore the Number switchover.
NumberSO & operator=(NumberSO const &)=delete
NumberSO(NumberSO const &)=delete
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
void setSTNumberSwitchover(bool v)
IOUAmount mulRatio(IOUAmount const &amt, std::uint32_t num, std::uint32_t den, bool roundUp)
std::string to_string(base_uint< Bits, Tag > const &a)
bool getSTNumberSwitchover()
Zero allows classes to offer efficient comparisons to zero.