8#ifndef INCLUDED_BDLDFP_DECIMAL
9#define INCLUDED_BDLDFP_DECIMAL
692#include <bdldfp_decimal.fwd.h>
723#include <bsl_cstddef.h>
724#include <bsl_cstring.h>
726#include <bsl_iosfwd.h>
727#include <bsl_iterator.h>
728#include <bsl_limits.h>
729#include <bsl_locale.h>
731#ifndef BDE_DONT_ALLOW_TRANSITIVE_INCLUDES
737#define BDLDFP_DECIMAL_DF(lit) \
738 BloombergLP::bdldfp::Decimal32(BDLDFP_DECIMALIMPUTIL_DF(lit))
740#define BDLDFP_DECIMAL_DD(lit) \
741 BloombergLP::bdldfp::Decimal64(BDLDFP_DECIMALIMPUTIL_DD(lit))
743#define BDLDFP_DECIMAL_DL(lit) \
744 BloombergLP::bdldfp::Decimal128(BDLDFP_DECIMALIMPUTIL_DL(lit))
1273 template <
class STREAM>
1296 template <
class STREAM>
1788template <
class CHARTYPE,
class TRAITS>
1789bsl::basic_istream<CHARTYPE, TRAITS>&
1801template <
class CHARTYPE,
class TRAITS>
1802bsl::basic_ostream<CHARTYPE, TRAITS>&
1805#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
1806 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
1807inline namespace literals {
1808inline namespace DecimalLiterals {
1878template <
class HASHALG>
2342 template <
class STREAM>
2364 template <
class STREAM>
2381 bsl::ostream&
print(bsl::ostream& stream,
2383 int spacesPerLevel = 4)
const;
2998template <
class CHARTYPE,
class TRAITS>
2999bsl::basic_istream<CHARTYPE, TRAITS>&
3011template <
class CHARTYPE,
class TRAITS>
3012bsl::basic_ostream<CHARTYPE, TRAITS>&
3015#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
3016 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
3017inline namespace literals {
3018inline namespace DecimalLiterals {
3088template <
class HASHALG>
3506 template <
class STREAM>
3528 template <
class STREAM>
4165template <
class CHARTYPE,
class TRAITS>
4166bsl::basic_istream<CHARTYPE, TRAITS>&
4178template <
class CHARTYPE,
class TRAITS>
4179bsl::basic_ostream<CHARTYPE, TRAITS>&
4182#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
4183 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
4184inline namespace literals {
4185inline namespace DecimalLiterals {
4256template <
class HASHALG>
4272template <
class CHARTYPE,
4273 class INPUTITERATOR = bsl::istreambuf_iterator<CHARTYPE> >
4276#if defined(BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD)
4279 bsl::locale::id& __get_id()
const;
4294 static bsl::locale::id
id;
4315 bsl::ios_base::iostate& err,
4320 bsl::ios_base::iostate& err,
4325 bsl::ios_base::iostate& err,
4355 bsl::ios_base::iostate& err,
4360 bsl::ios_base::iostate& err,
4365 bsl::ios_base::iostate& err,
4381template <class CHARTYPE,
bool WCHAR_8_BITS>
4392template <
bool WCHAR_8_BIT>
4396 const char *d_begin;
4412 const bsl::locale&);
4418 const char *begin()
const;
4422 const char *end()
const;
4437 wchar_t *d_buffer_p;
4455 const bsl::locale& loc);
4463 const wchar_t *begin()
const;
4466 const wchar_t *end()
const;
4479template <
class t_CHAR>
4506 typename Parser::ProcessingState d_parsingStatus;
4510 FormatType d_formatType;
4548 template <
class t_PARSE_CONTEXT>
4558 template <
typename t_FORMAT_CONTEXT>
4559 void postprocess(
const t_FORMAT_CONTEXT& context);
4609 postprocessedWidth()
const;
4620 postprocessedPrecision()
const;
4651template <
class t_VALUE,
class t_CHAR>
4666 static const size_t k_NO_POS = (size_t)(-1);
4678 template <
class t_FORMAT_CONTEXT>
4679 typename t_FORMAT_CONTEXT::iterator alignAndCopy(
4680 const char *numberBuffer,
4681 size_t numberLength,
4682 t_FORMAT_CONTEXT& formatContext,
4694 template <
class t_FORMAT_CONTEXT>
4695 typename t_FORMAT_CONTEXT::iterator format(
4696 const t_VALUE& value,
4697 t_FORMAT_CONTEXT& formatContext)
const;
4705 template <
class t_PARSE_CONTEXT>
4707 typename t_PARSE_CONTEXT::iterator
4708 parse(t_PARSE_CONTEXT& parseContext);
4720template <
bool WCHAR_8_BIT>
4727, d_end(buffer + len)
4734template <
bool WCHAR_8_BIT>
4741template <
bool WCHAR_8_BIT>
4757 const bsl::locale& loc)
4766 d_buffer_p = (
wchar_t *)allocator->
allocate(
sizeof(
wchar_t) * len);
4768 bsl::use_facet<std::ctype<wchar_t> >(loc).widen(buffer,
4791 return d_buffer_p + d_len;
4805template <
class CHARTYPE,
4806 class OUTPUTITERATOR = bsl::ostreambuf_iterator<CHARTYPE> >
4809#if defined(BSLS_LIBRARYFEATURES_STDCPP_LIBCSTD)
4812 bsl::locale::id& __get_id()
const;
4827 static bsl::locale::id
id;
4887 bsl::ios_base& ios_format,
4891 bsl::ios_base& ios_format,
4895 bsl::ios_base& ios_format,
4905 template <class DECIMAL>
4907 bsl::ios_base& ios_format,
4909 DECIMAL value) const;
4929template<
class NUMERIC_TYPE,
class DUMMY_TYPE =
void>
4942template<
class DUMMY_TYPE>
4951 static const bool is_specialized =
false;
4958template<
class DUMMY_TYPE>
4970 static const bool is_specialized =
true;
4975 static const int digits = 7;
4980 static const int digits10 = digits;
4987 static const int max_digits10 = digits;
4990 static const bool is_signed =
true;
4993 static const bool is_integer =
false;
5000 static const bool is_exact =
false;
5003 static const int radix = 10;
5008 static const int min_exponent = -95;
5015 static const int min_exponent10 = min_exponent;
5020 static const int max_exponent = 96;
5027 static const int max_exponent10 = max_exponent;
5030 static const bool has_infinity =
true;
5034 static const bool has_quiet_NaN =
true;
5037 static const bool has_signaling_NaN =
true;
5041 static const std::float_denorm_style has_denorm = std::denorm_present;
5046 static const bool has_denorm_loss =
true;
5049 static const bool is_bounded =
true;
5052 static const bool is_iec559 =
false;
5055 static const bool is_modulo =
false;
5059 static const bool tinyness_before =
true;
5063 static const bool traps =
true;
5068 static const int max_precision = digits10 - 1 + (-min_exponent10);
5074 static const std::float_round_style round_style = std::round_indeterminate;
5081template<
class DUMMY_TYPE>
5093 static const bool is_specialized =
true;
5098 static const int digits = 16;
5103 static const int digits10 = digits;
5110 static const int max_digits10 = digits;
5113 static const bool is_signed =
true;
5116 static const bool is_integer =
false;
5123 static const bool is_exact =
false;
5126 static const int radix = 10;
5131 static const int min_exponent = -383;
5138 static const int min_exponent10 = min_exponent;
5143 static const int max_exponent = 384;
5150 static const int max_exponent10 = max_exponent;
5153 static const bool has_infinity =
true;
5157 static const bool has_quiet_NaN =
true;
5160 static const bool has_signaling_NaN =
true;
5164 static const std::float_denorm_style has_denorm = std::denorm_present;
5169 static const bool has_denorm_loss =
true;
5172 static const bool is_iec559 =
false;
5175 static const bool is_bounded =
true;
5178 static const bool is_modulo =
false;
5182 static const bool traps =
true;
5186 static const bool tinyness_before =
true;
5191 static const int max_precision = digits10 - 1 + (-min_exponent10);
5195 static const std::float_round_style round_style = std::round_indeterminate;
5202template<
class DUMMY_TYPE>
5215 static const bool is_specialized =
true;
5220 static const int digits = 34;
5225 static const int digits10 = digits;
5232 static const int max_digits10 = digits;
5235 static const bool is_signed =
true;
5238 static const bool is_integer =
false;
5245 static const bool is_exact =
false;
5248 static const int radix = 10;
5253 static const int min_exponent = -6143;
5260 static const int min_exponent10 = min_exponent;
5265 static const int max_exponent = 6144;
5272 static const int max_exponent10 = max_exponent;
5275 static const bool has_infinity =
true;
5279 static const bool has_quiet_NaN =
true;
5282 static const bool has_signaling_NaN =
true;
5286 static const std::float_denorm_style has_denorm = std::denorm_present;
5291 static const bool has_denorm_loss =
true;
5294 static const bool is_iec559 =
false;
5297 static const bool is_bounded =
true;
5300 static const bool is_modulo =
false;
5304 static const bool traps =
true;
5308 static const bool tinyness_before =
true;
5313 static const int max_precision = digits10 - 1 + (-min_exponent10);
5317 static const std::float_round_style round_style = std::round_indeterminate;
5325template<
class DUMMY_TYPE>
5328template<
class DUMMY_TYPE>
5331template<
class DUMMY_TYPE>
5334template<
class DUMMY_TYPE>
5337template<
class DUMMY_TYPE>
5340template<
class DUMMY_TYPE>
5343template<
class DUMMY_TYPE>
5346template<
class DUMMY_TYPE>
5349template<
class DUMMY_TYPE>
5352template<
class DUMMY_TYPE>
5355template<
class DUMMY_TYPE>
5358template<
class DUMMY_TYPE>
5361template<
class DUMMY_TYPE>
5364template<
class DUMMY_TYPE>
5367template<
class DUMMY_TYPE>
5370template<
class DUMMY_TYPE>
5371const std::float_denorm_style
5374template<
class DUMMY_TYPE>
5377template<
class DUMMY_TYPE>
5380template<
class DUMMY_TYPE>
5383template<
class DUMMY_TYPE>
5386template<
class DUMMY_TYPE>
5389template<
class DUMMY_TYPE>
5392template<
class DUMMY_TYPE>
5393const std::float_round_style
5400template<
class DUMMY_TYPE>
5403template<
class DUMMY_TYPE>
5406template<
class DUMMY_TYPE>
5409template<
class DUMMY_TYPE>
5412template<
class DUMMY_TYPE>
5415template<
class DUMMY_TYPE>
5418template<
class DUMMY_TYPE>
5421template<
class DUMMY_TYPE>
5424template<
class DUMMY_TYPE>
5427template<
class DUMMY_TYPE>
5430template<
class DUMMY_TYPE>
5433template<
class DUMMY_TYPE>
5436template<
class DUMMY_TYPE>
5439template<
class DUMMY_TYPE>
5442template<
class DUMMY_TYPE>
5445template<
class DUMMY_TYPE>
5446const std::float_denorm_style
5449template<
class DUMMY_TYPE>
5452template<
class DUMMY_TYPE>
5455template<
class DUMMY_TYPE>
5458template<
class DUMMY_TYPE>
5461template<
class DUMMY_TYPE>
5464template<
class DUMMY_TYPE>
5467template<
class DUMMY_TYPE>
5468const std::float_round_style
5475template<
class DUMMY_TYPE>
5478template<
class DUMMY_TYPE>
5481template<
class DUMMY_TYPE>
5484template<
class DUMMY_TYPE>
5487template<
class DUMMY_TYPE>
5490template<
class DUMMY_TYPE>
5493template<
class DUMMY_TYPE>
5496template<
class DUMMY_TYPE>
5499template<
class DUMMY_TYPE>
5502template<
class DUMMY_TYPE>
5505template<
class DUMMY_TYPE>
5508template<
class DUMMY_TYPE>
5511template<
class DUMMY_TYPE>
5514template<
class DUMMY_TYPE>
5517template<
class DUMMY_TYPE>
5520template<
class DUMMY_TYPE>
5521const std::float_denorm_style
5524template<
class DUMMY_TYPE>
5527template<
class DUMMY_TYPE>
5530template<
class DUMMY_TYPE>
5533template<
class DUMMY_TYPE>
5536template<
class DUMMY_TYPE>
5539template<
class DUMMY_TYPE>
5542template<
class DUMMY_TYPE>
5543const std::float_round_style
5563 :
public BloombergLP::bdldfp::faux_numeric_limits<
5564 BloombergLP::bdldfp::Decimal_StandardNamespaceCanary> {
5573 :
public BloombergLP::bdldfp::faux_numeric_limits<
5574 BloombergLP::bdldfp::Decimal32> {
5621class numeric_limits<BloombergLP::
bdldfp::Decimal64>
5622 : public BloombergLP::
bdldfp::faux_numeric_limits<
5623 BloombergLP::
bdldfp::Decimal64> {
5672class numeric_limits<BloombergLP::
bdldfp::Decimal128>
5673 : public BloombergLP::
bdldfp::faux_numeric_limits<
5674 BloombergLP::
bdldfp::Decimal128> {
5738int Decimal_Type32::maxSupportedBdexVersion()
5744int Decimal_Type32::maxSupportedBdexVersion(
int )
5751Decimal_Type32::Decimal_Type32()
5753 bsl::memset(&d_value, 0,
sizeof(d_value));
6037template <
class STREAM>
6044 stream.getUint32(bidVal);
6047 d_value.d_raw = bidVal;
6050 stream.invalidate();
6054 stream.invalidate();
6075template <
class STREAM>
6081 stream.putUint32(d_value.d_raw);
6084 stream.invalidate();
6114 bsl::memset(&d_value, 0,
sizeof(d_value));
6396template <
class STREAM>
6403 stream.getUint64(bidVal);
6406 d_value.d_raw = bidVal;
6409 stream.invalidate();
6413 stream.invalidate();
6442template <
class STREAM>
6448 stream.putUint64(d_value.d_raw);
6451 stream.invalidate();
6481 bsl::memset(&d_value, 0,
sizeof(d_value));
6799template <
class STREAM>
6807 /
sizeof(
unsigned char);
6809 unsigned char *value_p =
6810 reinterpret_cast<unsigned char *
>(&bidVal);
6812#ifdef BSLS_PLATFORM_IS_BIG_ENDIAN
6813 for (
int i(0); i < len; ++i) {
6814 stream.getUint8(*(value_p + i));
6816#elif defined(BSLS_PLATFORM_IS_LITTLE_ENDIAN)
6817 for (
int i(len - 1); i >= 0; --i) {
6818 stream.getUint8(*(value_p + i));
6822 d_value.d_raw = bidVal;
6825 stream.invalidate();
6829 stream.invalidate();
6850template <
class STREAM>
6857 /
sizeof(
unsigned char);
6859 const unsigned char *value_p =
6860 reinterpret_cast<const unsigned char *
>(&d_value.d_raw);
6862#ifdef BSLS_PLATFORM_IS_BIG_ENDIAN
6863 for (
int i(0); i < len; ++i) {
6864 stream.putUint8(*(value_p + i));
6866#elif defined(BSLS_PLATFORM_IS_LITTLE_ENDIAN)
6867 for (
int i(len - 1); i >= 0; --i) {
6868 stream.putUint8(*(value_p + i));
6873 stream.invalidate();
6885template <
class t_CHAR>
6891 if (typeString.
empty()) {
6892 d_formatType = e_FORMAT_DEFAULT;
6897 if (typeString.
size() > 1) {
6898 d_formatType = e_TYPE_UNASSIGNED;
6900 "Decimal floating point format types are single-character"));
6903 const t_CHAR frontChar = typeString.
front();
6906 const char typeChar = (frontChar >= 0 && frontChar <= 0x7f)
6907 ?
static_cast<char>(frontChar)
6908 :
static_cast<char>(0);
6912 d_formatType = e_FORMAT_SCIENTIFIC;
6915 d_formatType = e_FORMAT_SCIENTIFIC_UC;
6918 d_formatType = e_FORMAT_FIXED;
6921 d_formatType = e_FORMAT_FIXED_UC;
6924 d_formatType = e_FORMAT_GENERAL;
6927 d_formatType = e_FORMAT_GENERAL_UC;
6930 d_formatType = e_TYPE_UNASSIGNED;
6932 "Invalid format type for decimal floating points"));
6936 if (e_TYPE_UNASSIGNED == d_formatType)
6938 "Failed to parse decimal floating point format type "
6939 "(reason unknown)"));
6945template <
class t_CHAR>
6947void Decimal_FormatterSpecification<t_CHAR>::ensureParsingComplete()
const
6949 if (d_parsingStatus == Parser::e_STATE_UNPARSED) {
6951 "Decimal format specification '.parse()' was not called"));
6955template <
class t_CHAR>
6957Decimal_FormatterSpecification<t_CHAR>::ensurePostprocessingComplete()
const
6959 if (d_parsingStatus != Parser::e_STATE_POSTPROCESSED) {
6961 "Decimal format specification '.postprocess()' was not called"));
6966template <
class t_CHAR>
6969: d_parsingStatus(
Parser::e_STATE_UNPARSED)
6971, d_formatType(e_TYPE_UNASSIGNED)
6976template <
class t_CHAR>
6980 ensurePostprocessingComplete();
6981 return d_parser.filler();
6984template <
class t_CHAR>
6988 ensurePostprocessingComplete();
6989 return d_parser.numFillerCharacters();
6992template <
class t_CHAR>
6996 ensurePostprocessingComplete();
6997 return d_parser.fillerCodePointDisplayWidth();
7000template <
class t_CHAR>
7005 ensureParsingComplete();
7006 return d_parser.alignment();
7009template <
class t_CHAR>
7014 ensureParsingComplete();
7015 return d_parser.sign();
7018template <
class t_CHAR>
7022 ensureParsingComplete();
7023 return d_parser.alternativeFlag();
7026template <
class t_CHAR>
7030 ensureParsingComplete();
7031 return d_parser.zeroPaddingFlag();
7034template <
class t_CHAR>
7039 ensurePostprocessingComplete();
7040 return d_parser.postprocessedWidth();
7043template <
class t_CHAR>
7048 ensurePostprocessingComplete();
7049 return d_parser.postprocessedPrecision();
7052template <
class t_CHAR>
7056 ensureParsingComplete();
7057 return d_parser.localeSpecificFlag();
7060template <
class t_CHAR>
7065 ensureParsingComplete();
7066 return d_formatType;
7070template <
class t_CHAR>
7071template <
class t_PARSE_CONTEXT>
7077 typename t_PARSE_CONTEXT::const_iterator>::value_type,
7080 d_parsingStatus = Parser::e_STATE_PARSED;
7084 Parser::e_SECTIONS_FILL_ALIGN |
7085 Parser::e_SECTIONS_SIGN_FLAG |
7086 Parser::e_SECTIONS_ALTERNATE_FLAG |
7087 Parser::e_SECTIONS_ZERO_PAD_FLAG |
7088 Parser::e_SECTIONS_WIDTH |
7089 Parser::e_SECTIONS_PRECISION |
7090 Parser::e_SECTIONS_LOCALE_FLAG |
7091 Parser::e_SECTIONS_REMAINING_SPEC);
7093 d_parser.parse(context, sect);
7095 parseType(d_parser.remainingSpec());
7097 if (context->begin() == context->end() || *context->begin() ==
'}') {
7102 "Decimal floating point specification parse failure "
7103 "(invalid character)"));
7106template <
class t_CHAR>
7107template <
typename t_FORMAT_CONTEXT>
7109 const t_FORMAT_CONTEXT& context)
7111 ensureParsingComplete();
7113 d_parser.postprocess(context);
7115 switch (d_parser.postprocessedWidth().category()) {
7119 if (d_parser.postprocessedWidth().value() <= 0)
7120 BSLS_THROW(bsl::format_error(
"Zero or negative width value"));
7124 BSLS_THROW(bsl::format_error(
"Failed to find valid width value"));
7129 switch (d_parser.postprocessedPrecision().category()) {
7133 if (d_parser.postprocessedPrecision().value() < 0)
7134 BSLS_THROW(bsl::format_error(
"Negative precision value"));
7137 BSLS_THROW(bsl::format_error(
"Failed to find valid precision value"));
7142 d_parsingStatus = Parser::e_STATE_POSTPROCESSED;
7150template <
class t_VALUE,
class t_CHAR>
7151template <
class t_FORMAT_CONTEXT>
7152typename t_FORMAT_CONTEXT::iterator
7154 const char *numberBuffer,
7155 size_t numberLength,
7156 t_FORMAT_CONTEXT& formatContext,
7157 const Specification& finalSpec)
const
7164 NumericValue finalWidth(finalSpec.postprocessedWidth());
7166 std::ptrdiff_t leftPadFillerCopiesNum = 0;
7167 std::ptrdiff_t rightPadFillerCopiesNum = 0;
7168 std::ptrdiff_t zeroPadFillerCopiesNum = 0;
7170 const char signChar = *numberBuffer ==
'-'
7172 : *numberBuffer ==
'+'
7174 : *numberBuffer ==
' '
7177 const bool hasSignChar = (signChar != 0);
7187 const char lastChar = numberBuffer[numberLength - 1];
7188 const bool specialValue =
'f' == lastChar ||
'n' == lastChar
7189 ||
'F' == lastChar ||
'N' == lastChar;
7191 if ((NumericValue::e_DEFAULT != finalWidth.category()) &&
7192 (numberLength + hasSignChar <
7193 static_cast<size_t>(finalWidth.value()))) {
7196 if (!specialValue &&
7197 Parser::e_ALIGN_DEFAULT == finalSpec.alignment() &&
7198 finalSpec.zeroPaddingFlag()) {
7201 zeroPadFillerCopiesNum =
7202 finalWidth.value() - (numberLength + hasSignChar);
7207 PadUtil::computePadding(&leftPadFillerCopiesNum,
7208 &rightPadFillerCopiesNum,
7210 numberLength + hasSignChar,
7212 Parser::e_ALIGN_RIGHT);
7218 typename t_FORMAT_CONTEXT::iterator outIterator = formatContext.out();
7220 finalSpec.fillerCharacters());
7222 outIterator = PadUtil::pad(outIterator, leftPadFillerCopiesNum, filler);
7225 outIterator = FormatterCharUtil::outputFromChar(signChar, outIterator);
7228 outIterator = PadUtil::pad(outIterator, zeroPadFillerCopiesNum,
'0');
7230 outIterator = FormatterCharUtil::outputFromChar(
7232 numberBuffer + numberLength,
7235 outIterator = PadUtil::pad(outIterator, rightPadFillerCopiesNum, filler);
7240template <
class t_VALUE,
class t_CHAR>
7241template <
class t_PARSE_CONTEXT>
7244 t_PARSE_CONTEXT& parseContext)
7246 d_spec.parse(&parseContext);
7248 if (d_spec.localeSpecificFlag()) {
7250 "Formatting with the L specifier is not supported"));
7253 return parseContext.begin();
7256template <
class t_VALUE,
class t_CHAR>
7257template <
class t_FORMAT_CONTEXT>
7258typename t_FORMAT_CONTEXT::iterator
7260 const t_VALUE& value,
7261 t_FORMAT_CONTEXT& formatContext)
const
7270 const int precision = NumericValue::e_DEFAULT ==
7277 bool upperCase =
false;
7280 case Specification::e_FORMAT_SCIENTIFIC_UC:
7283 case Specification::e_FORMAT_SCIENTIFIC: {
7287 case Specification::e_FORMAT_FIXED_UC:
7290 case Specification::e_FORMAT_FIXED: {
7295 case Specification::e_FORMAT_GENERAL_UC:
7299 case Specification::e_FORMAT_GENERAL:
break;
7302 BSLS_THROW(bsl::format_error(
"Unknown decimal floating point format"));
7306 switch (finalSpec.
sign()) {
7308 case Parser::e_SIGN_NEGATIVE: {
7311 case Parser::e_SIGN_POSITIVE: {
7314 case Parser::e_SIGN_SPACE: {
7335 typedef bsl::numeric_limits<t_VALUE> Limits;
7336 const int effectivePrecision = precision > Limits::max_precision
7338 : Limits::max_precision;
7340 const int k_STACK_BUF_LEN = 1
7341 + 1 + Limits::max_exponent10
7343 + Limits::max_precision;
7345 const int reqdBufferSize = 1
7346 + 1 + Limits::max_exponent10
7348 + effectivePrecision;
7353 char sbuf[k_STACK_BUF_LEN];
7355 char *buffer = sbuf;
7358 if (reqdBufferSize > k_STACK_BUF_LEN) {
7359 dbuf = allocator.
allocate(reqdBufferSize);
7365 dbuf ? reqdBufferSize : 0);
7373 return alignAndCopy(buffer, len, formatContext, finalSpec);
7455 unsigned long long rhs)
7549 unsigned long long rhs)
7641 unsigned long long rhs)
7734 unsigned long long rhs)
7818#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
7819 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
7828 const char *str, bsl::size_t)
7923 unsigned long long rhs)
8030 unsigned long long rhs)
8128 unsigned long long rhs)
8220 unsigned long long rhs)
8363#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
8364 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
8373 const char *str, bsl::size_t)
8483 unsigned long long rhs)
8604 unsigned long long rhs)
8725 unsigned long long rhs)
8846 unsigned long long rhs)
9085#if defined(BSLS_COMPILERFEATURES_SUPPORT_INLINE_NAMESPACE) && \
9086 defined(BSLS_COMPILERFEATURES_SUPPORT_USER_DEFINED_LITERALS)
9095 const char *str, bsl::size_t)
9102template <
class HASHALG>
9106 using ::BloombergLP::bslh::hashAppend;
9110 hashAlg(&normalizedObject,
sizeof(normalizedObject));
9113template <
class HASHALG>
9117 using ::BloombergLP::bslh::hashAppend;
9122 hashAlg(&normalizedObject,
sizeof(normalizedObject));
9125template <
class HASHALG>
9129 using ::BloombergLP::bslh::hashAppend;
9134 hashAlg(&normalizedObject,
sizeof(normalizedObject));
9144template <
class t_CHAR>
9146: BloombergLP::bdldfp::Decimal_BslFmtFormatterImpl<
9147 BloombergLP::bdldfp::Decimal32,
9153template <
class t_CHAR>
9155: BloombergLP::bdldfp::Decimal_BslFmtFormatterImpl<
9156 BloombergLP::bdldfp::Decimal64,
9162template <
class t_CHAR>
9164: BloombergLP::bdldfp::Decimal_BslFmtFormatterImpl<
9165 BloombergLP::bdldfp::Decimal128,
Definition bdldfp_decimalimputil.h:238
static ValueType32 normalize(ValueType32 original)
static bool lessEqual(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2764
static ValueType64 parse64(const char *input)
Definition bdldfp_decimalimputil.h:3107
static ValueType32 parse32(const char *input)
Definition bdldfp_decimalimputil.h:3100
static bool notEqual(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2842
static bool less(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2712
Imp::ValueType64 ValueType64
Definition bdldfp_decimalimputil.h:250
static bool greater(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2738
static ValueType32 multiply(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:1676
static ValueType32 divide(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:1704
Imp::ValueType128 ValueType128
Definition bdldfp_decimalimputil.h:251
static int format(char *buffer, int length, ValueType32 value, const DecimalFormatConfig &cfg)
static ValueType128 parse128(const char *input)
Definition bdldfp_decimalimputil.h:3114
static ValueType32 subtract(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:1650
static bool equal(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2816
static ValueType32 negate(ValueType32 value)
Definition bdldfp_decimalimputil.h:2687
static bool greaterEqual(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:2790
static ValueType32 add(ValueType32 lhs, ValueType32 rhs)
Definition bdldfp_decimalimputil.h:1625
Imp::ValueType32 ValueType32
Definition bdldfp_decimalimputil.h:249
Definition bdldfp_decimal.h:4274
~DecimalNumGet() BSLS_KEYWORD_OVERRIDE
INPUTITERATOR iter_type
Definition bdldfp_decimal.h:4297
iter_type get(iter_type begin, iter_type end, bsl::ios_base &str, bsl::ios_base::iostate &err, Decimal64 &value) const
static const DecimalNumGet< CHARTYPE, INPUTITERATOR > & object()
static bsl::locale::id id
Definition bdldfp_decimal.h:4294
iter_type get(iter_type begin, iter_type end, bsl::ios_base &str, bsl::ios_base::iostate &err, Decimal32 &value) const
CHARTYPE char_type
Definition bdldfp_decimal.h:4296
iter_type get(iter_type begin, iter_type end, bsl::ios_base &str, bsl::ios_base::iostate &err, Decimal128 &value) const
DecimalNumGet(bsl::size_t refs=0)
virtual iter_type do_get(iter_type begin, iter_type end, bsl::ios_base &str, bsl::ios_base::iostate &err, Decimal32 &value) const
Definition bdldfp_decimal.h:4382
Definition bdldfp_decimal.h:4807
iter_type put(iter_type out, bsl::ios_base &str, char_type fill, Decimal64 value) const
iter_type put(iter_type out, bsl::ios_base &str, char_type fill, Decimal32 value) const
OUTPUTITERATOR iter_type
Definition bdldfp_decimal.h:4830
static const DecimalNumPut< CHARTYPE, OUTPUTITERATOR > & object()
virtual iter_type do_put(iter_type out, bsl::ios_base &ios_format, char_type fill, Decimal32 value) const
CHARTYPE char_type
Definition bdldfp_decimal.h:4829
~DecimalNumPut() BSLS_KEYWORD_OVERRIDE
iter_type put(iter_type out, bsl::ios_base &str, char_type fill, Decimal128 value) const
DecimalNumPut(bsl::size_t refs=0)
iter_type do_put_impl(iter_type out, bsl::ios_base &ios_format, char_type fill, DECIMAL value) const
static bsl::locale::id id
Definition bdldfp_decimal.h:4827
Definition bdldfp_decimal.h:4920
Definition bdldfp_decimal.h:3101
Decimal_Type128 & operator++()
Definition bdldfp_decimal.h:6547
Decimal_Type128 & operator/=(Decimal32 rhs)
Definition bdldfp_decimal.h:6734
Decimal_Type128()
Definition bdldfp_decimal.h:6479
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdldfp_decimal.h:6800
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdldfp_decimal.h:6851
Decimal_Type128 & operator*=(Decimal32 rhs)
Definition bdldfp_decimal.h:6676
Decimal128_Type & operator=(const Decimal128_Type &rhs)=default
static int maxSupportedBdexVersion()
Definition bdldfp_decimal.h:6466
Decimal_Type128 & operator+=(Decimal32 rhs)
Definition bdldfp_decimal.h:6561
Decimal_Type128 & operator--()
Definition bdldfp_decimal.h:6553
DecimalImpUtil::ValueType128 * data()
Return a modifiable pointer to the underlying implementation.
Definition bdldfp_decimal.h:6792
Decimal128_Type(const Decimal128_Type &original)=default
Decimal_Type128 & operator-=(Decimal32 rhs)
Definition bdldfp_decimal.h:6618
DecimalImpUtil::ValueType128 value() const
Return the value of the underlying implementation.
Definition bdldfp_decimal.h:6843
BSLMF_NESTED_TRAIT_DECLARATION(Decimal_Type128, bsl::is_trivially_copyable)
~Decimal128_Type()=default
Definition bdldfp_decimal.h:765
Decimal_Type32 & operator-=(Decimal32 rhs)
Definition bdldfp_decimal.h:5886
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdldfp_decimal.h:6038
DecimalImpUtil::ValueType32 * data()
Definition bdldfp_decimal.h:6030
Decimal_Type32 & operator--()
Definition bdldfp_decimal.h:5831
Decimal_Type32()
Definition bdldfp_decimal.h:5751
Decimal32_Type(const Decimal32_Type &original)=default
DecimalImpUtil::ValueType32 value() const
Return the value of the underlying implementation.
Definition bdldfp_decimal.h:6068
Decimal_Type32 & operator++()
Definition bdldfp_decimal.h:5826
Decimal_Type32 & operator+=(Decimal32 rhs)
Definition bdldfp_decimal.h:5838
~Decimal32_Type()=default
Decimal32_Type & operator=(const Decimal32_Type &rhs)=default
static int maxSupportedBdexVersion()
Definition bdldfp_decimal.h:5738
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdldfp_decimal.h:6076
Decimal_Type32 & operator*=(Decimal32 rhs)
Definition bdldfp_decimal.h:5934
BSLMF_NESTED_TRAIT_DECLARATION(Decimal_Type32, bsl::is_trivially_copyable)
Decimal_Type32 & operator/=(Decimal32 rhs)
Definition bdldfp_decimal.h:5982
Definition bdldfp_decimal.h:1890
Decimal_Type64 & operator*=(Decimal32 rhs)
Definition bdldfp_decimal.h:6300
Decimal_Type64 & operator+=(Decimal32 rhs)
Definition bdldfp_decimal.h:6204
Decimal_Type64 & operator/=(Decimal32 rhs)
Definition bdldfp_decimal.h:6348
STREAM & bdexStreamOut(STREAM &stream, int version) const
Definition bdldfp_decimal.h:6443
DecimalImpUtil::ValueType64 value() const
Return the value of the underlying implementation.
Definition bdldfp_decimal.h:6435
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
STREAM & bdexStreamIn(STREAM &stream, int version)
Definition bdldfp_decimal.h:6397
~Decimal64_Type()=default
Decimal64_Type & operator=(const Decimal64_Type &rhs)=default
Decimal_Type64 & operator++()
Definition bdldfp_decimal.h:6192
static int maxSupportedBdexVersion()
Definition bdldfp_decimal.h:6099
BSLMF_NESTED_TRAIT_DECLARATION(Decimal_Type64, bsl::is_trivially_copyable)
Decimal_Type64()
Definition bdldfp_decimal.h:6112
Decimal64_Type(const Decimal64_Type &original)=default
Decimal_Type64 & operator--()
Definition bdldfp_decimal.h:6197
DecimalImpUtil::ValueType64 * data()
Return a modifiable pointer to the underlying implementation.
Definition bdldfp_decimal.h:6425
Decimal_Type64 & operator-=(Decimal32 rhs)
Definition bdldfp_decimal.h:6252
Definition bdldfp_decimal.h:4930
Definition bslstl_stringview.h:471
BSLS_KEYWORD_CONSTEXPR size_type size() const BSLS_KEYWORD_NOEXCEPT
Return the length of this view.
Definition bslstl_stringview.h:1904
BSLS_KEYWORD_CONSTEXPR_CPP14 const_reference front() const
Definition bslstl_stringview.h:1966
BSLS_KEYWORD_CONSTEXPR bool empty() const BSLS_KEYWORD_NOEXCEPT
Return true if this view has length 0, and false otherwise.
Definition bslstl_stringview.h:1931
Definition bslma_polymorphicallocator.h:460
BSLS_ANNOTATION_NODISCARD TYPE * allocate(std::size_t n)
Definition bslma_polymorphicallocator.h:963
Definition bslma_allocator.h:545
virtual void deallocate(void *address)=0
virtual void * allocate(size_type size)=0
Definition bslma_deallocatebytesproctor.h:272
static BloombergLP::bdldfp::Decimal128 min() BSLS_KEYWORD_NOEXCEPT
static BloombergLP::bdldfp::Decimal32 min() BSLS_KEYWORD_NOEXCEPT
static BloombergLP::bdldfp::Decimal64 min() BSLS_KEYWORD_NOEXCEPT
#define BSLA_FALLTHROUGH
Definition bsla_fallthrough.h:188
#define BSLMF_ASSERT(expr)
Definition bslmf_assert.h:231
#define BSLS_ANNOTATION_DEPRECATED
Definition bsls_annotation.h:324
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1976
#define BSLS_THROW(X)
Definition bsls_exceptionutil.h:374
#define BSLS_IDENT(str)
BSLS_IDENT() - insert string into .comment binary segment (if supported)
Definition bsls_ident.h:238
#define BSLS_KEYWORD_CONSTEXPR_CPP20
Definition bsls_keyword.h:645
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:674
#define BSLS_KEYWORD_OVERRIDE
Definition bsls_keyword.h:695
Definition bdldfp_decimal.h:747
Decimal_Type128 Decimal128
Definition bdldfp_decimal.h:754
bsl::basic_istream< CHARTYPE, TRAITS > & operator>>(bsl::basic_istream< CHARTYPE, TRAITS > &stream, Decimal32 &object)
Decimal32 operator/(Decimal32 lhs, Decimal32 rhs)
bsl::basic_ostream< CHARTYPE, TRAITS > & operator<<(bsl::basic_ostream< CHARTYPE, TRAITS > &stream, Decimal32 object)
bool operator!=(Decimal32 lhs, Decimal32 rhs)
bool operator<(Decimal32 lhs, Decimal32 rhs)
Decimal_Type32 Decimal32
Definition bdldfp_decimal.h:749
void hashAppend(HASHALG &hashAlg, const Decimal32 &object)
Decimal32 operator--(Decimal32 &value, int)
Decimal_Type64 Decimal64
Definition bdldfp_decimal.h:750
Decimal32 operator-(Decimal32 value)
Decimal32 operator*(Decimal32 lhs, Decimal32 rhs)
bool operator>(Decimal32 lhs, Decimal32 rhs)
bool operator>=(Decimal32 lhs, Decimal32 rhs)
bool operator<=(Decimal32 lhs, Decimal32 rhs)
Decimal32 operator++(Decimal32 &value, int)
Decimal32 operator+(Decimal32 value)
bool operator==(Decimal32 lhs, Decimal32 rhs)
Definition bdlat_valuetypefunctions.h:939
ALLOCATOR const STRING_VIEW_LIKE_TYPE & rhs
Definition bslstl_string.h:3918
ALLOCATOR & lhs
Definition bslstl_string.h:3917
Definition bdldfp_decimal.h:5549
BID_UINT128 Type128
Definition bdldfp_decimalstorage.h:86
BID_UINT64 Type64
Definition bdldfp_decimalstorage.h:85
BID_UINT32 Type32
Definition bdldfp_decimalstorage.h:84
Definition bslmf_issame.h:146
Definition bslmf_istriviallycopyable.h:324
Definition bslfmt_padutil.h:151
static Allocator * allocator(Allocator *basicAllocator=0)
Definition bslma_default.h:913