1#ifndef XRPL_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED
2#define XRPL_PROTOCOL_AMOUNTCONVERSION_H_INCLUDED
4#include <xrpl/protocol/IOUAmount.h>
5#include <xrpl/protocol/STAmount.h>
6#include <xrpl/protocol/XRPAmount.h>
15 bool const isNeg = iou.
signum() < 0;
29 bool const isNeg = xrp.
signum() < 0;
39 "ripple::toSTAmount : is XRP");
60 "ripple::toAmount<IOUAmount> : maximum mantissa");
65 XRPL_ASSERT(!
isXRP(amt),
"ripple::toAmount<IOUAmount> : is not XRP");
75 "ripple::toAmount<XRPAmount> : maximum mantissa");
80 XRPL_ASSERT(
isXRP(amt),
"ripple::toAmount<XRPAmount> : is XRP");
130 static_assert(alwaysFalse,
"Unsupported type for toAmount");
152 static_assert(alwaysFalse,
"Unsupported type for toMaxAmount");
178 static_assert(alwaysFalse,
"Unsupported type for getIssue");
195 static_assert(alwaysFalse,
"Unsupported type for get");
Floating point representation of amounts with high dynamic range.
int exponent() const noexcept
int signum() const noexcept
Return the sign of the amount.
std::int64_t mantissa() const noexcept
A currency issued by an account.
constexpr int exponent() const noexcept
static rounding_mode getround()
static rounding_mode setround(rounding_mode mode)
constexpr rep mantissa() const noexcept
static std::uint64_t const cMaxNativeN
int exponent() const noexcept
static int const cMaxOffset
static std::uint64_t const cMaxValue
bool negative() const noexcept
std::uint64_t mantissa() const noexcept
constexpr int signum() const noexcept
Return the sign of the amount.
constexpr value_type drops() const
Returns the number of drops.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Issue const & xrpIssue()
Returns an asset specifier that represents XRP.
T toAmount(STAmount const &amt)=delete
bool isXRP(AccountID const &c)
STAmount toAmount< STAmount >(STAmount const &amt)
Issue getIssue(T const &amt)
STAmount toSTAmount(IOUAmount const &iou, Issue const &iss)
IOUAmount toAmount< IOUAmount >(STAmount const &amt)
Issue const & noIssue()
Returns an asset specifier that represents no account and currency.
T get(Section const §ion, std::string const &name, T const &defaultValue=T{})
Retrieve a key/value pair from a section.
T toMaxAmount(Issue const &issue)
XRPAmount toAmount< XRPAmount >(STAmount const &amt)