std::decimal(3cxx)

๐Ÿ’– std::decimal ๐Ÿ’–

ok so real talk, this is std::decimal from the 3cxx manual โ€” the whole ISO/IEC TR 24733 Decimal floating-point arithmetic situation. yes, it's a mouthful. no, you don't have to memorise it. it's giving "spec document energy" and honestly? we respect it. ๐ŸŽ€


โœจ SYNOPSIS โœจ

๐Ÿฆ‹ Classes

like, this is the whole cast of characters, bestie โ€” three of them, all decimal, all floating-point, all iconic in their own way:

  • class decimal128 โ€” that's 3.2.4 Class decimal128, the one with the big-girl digits ๐Ÿ’…
  • class decimal32 โ€” 3.2.2 Class decimal32, the smol one, cute, compact โœจ
  • class decimal64 โ€” 3.2.3 Class decimal64, the middle child, and honestly? she's serving ๐Ÿซถ
and yes, the numbers are literally 3.2.4, 3.2.2, 3.2.3 in that order up there โ€” not me re-sorting them, that's just how the page said it. we keep it exactly as it comes, fr fr ๐Ÿ’€

๐Ÿ› ๏ธ Functions

okay bestie, this is the part where the page goes absolutely feral with overloads โ€” but honestly? iconic behaviour. Every one of these lives in the std::decimal namespace and slays in its own little way. Buckle up, we're going through them in order. ๐Ÿ’…

  • double decimal128_to_double (decimal128 __d) โ€” takes your decimal128 and hands you back a plain double.
  • float decimal128_to_float (decimal128 __d) โ€” same deal, but the result is a float.
  • long double decimal128_to_long_double (decimal128 __d) โ€” yup, decimal128 โ†’ long double.
  • long long decimal128_to_long_long (decimal128 __d) โ€” decimal128 in, long long out.
  • double decimal32_to_double (decimal32 __d) โ€” decimal32 โ†’ double, no notes.
  • float decimal32_to_float (decimal32 __d) โ€” decimal32 โ†’ float.
  • long double decimal32_to_long_double (decimal32 __d) โ€” decimal32 โ†’ long double.
  • long long decimal32_to_long_long (decimal32 __d) โ€” decimal32 โ†’ long long. ๐Ÿซถ
"Non-conforming extension: Conversion to integral type." โ€” that's a direct quote from the page, so likeโ€ฆ it exists, it works, but it's not conforming. Don't act surprised when someone side-eyes you for using it. ๐Ÿ™ˆ
  • double decimal64_to_double (decimal64 __d) โ€” decimal64 โ†’ double.
  • float decimal64_to_float (decimal64 __d) โ€” decimal64 โ†’ float.
  • long double decimal64_to_long_double (decimal64 __d) โ€” decimal64 โ†’ long double.
  • long long decimal64_to_long_long (decimal64 __d) โ€” decimal64 โ†’ long long.

then we get the โœจgeneric-flavouredโœจ names, which are just the same three source types over and over and I'm obsessed with the consistency:

  • double decimal_to_double (decimal128 __d) โ€” decimal128 โ†’ double.
  • double decimal_to_double (decimal32 __d) โ€” decimal32 โ†’ double.
  • double decimal_to_double (decimal64 __d) โ€” decimal64 โ†’ double.
  • float decimal_to_float (decimal128 __d) โ€” decimal128 โ†’ float.
  • float decimal_to_float (decimal32 __d) โ€” decimal32 โ†’ float.
  • float decimal_to_float (decimal64 __d) โ€” decimal64 โ†’ float.
  • long double decimal_to_long_double (decimal128 __d) โ€” decimal128 โ†’ long double.
  • long double decimal_to_long_double (decimal32 __d) โ€” decimal32 โ†’ long double.
  • long double decimal_to_long_double (decimal64 __d) โ€” decimal64 โ†’ long double.
  • long long decimal_to_long_long (decimal128 __d) โ€” decimal128 โ†’ long long.
  • long long decimal_to_long_long (decimal32 __d) โ€” decimal32 โ†’ long long.
  • long long decimal_to_long_long (decimal64 __d) โ€” decimal64 โ†’ long long.

๐ŸŒธ the make_* girlies (they're static, very exclusive)

  • static decimal128 make_decimal128 (long long __coeff, int __exp) โ€” builds a decimal128 out of a long long coefficient plus an int exponent.
  • static decimal128 make_decimal128 (unsigned long long __coeff, int __exp) โ€” same, but the coefficient is unsigned long long.
  • static decimal32 make_decimal32 (long long __coeff, int __exp) โ€” decimal32 from a long long coefficient and an int exponent.
  • static decimal32 make_decimal32 (unsigned long long __coeff, int __exp) โ€” unsigned coefficient edition.
  • static decimal64 make_decimal64 (long long __coeff, int __exp) โ€” decimal64 from long long coefficient + int exponent.
  • static decimal64 make_decimal64 (unsigned long long __coeff, int __exp) โ€” and the unsigned long long twin. ๐ŸŽ€

๐Ÿ’€ operator!= โ€” the not-equal squad (there are SO many)

every single one of these returns bool, and every single one is a vibe check on "are these two not the same". starting with decimal128 on the left:

  • bool operator!= (decimal128 __lhs, decimal128 __rhs) โ€” decimal128 vs decimal128.
  • bool operator!= (decimal128 __lhs, decimal32 __rhs) โ€” decimal128 vs decimal32.
  • bool operator!= (decimal128 __lhs, decimal64 __rhs) โ€” decimal128 vs decimal64.
  • bool operator!= (decimal128 __lhs, int __rhs) โ€” decimal128 vs int.
  • bool operator!= (decimal128 __lhs, long __rhs) โ€” decimal128 vs long.
  • bool operator!= (decimal128 __lhs, long long __rhs) โ€” decimal128 vs long long.
  • bool operator!= (decimal128 __lhs, unsigned int __rhs) โ€” decimal128 vs unsigned int.
  • bool operator!= (decimal128 __lhs, unsigned long __rhs) โ€” decimal128 vs unsigned long.
  • bool operator!= (decimal128 __lhs, unsigned long long __rhs) โ€” decimal128 vs unsigned long long.

same energy, decimal32 on the left this time:

  • bool operator!= (decimal32 __lhs, decimal128 __rhs) โ€” decimal32 vs decimal128.
  • bool operator!= (decimal32 __lhs, decimal32 __rhs) โ€” decimal32 vs decimal32.
  • bool operator!= (decimal32 __lhs, decimal64 __rhs) โ€” decimal32 vs decimal64.
  • bool operator!= (decimal32 __lhs, int __rhs) โ€” decimal32 vs int.
  • bool operator!= (decimal32 __lhs, long __rhs) โ€” decimal32 vs long.
  • bool operator!= (decimal32 __lhs, long long __rhs) โ€” decimal32 vs long long.
  • bool operator!= (decimal32 __lhs, unsigned int __rhs) โ€” decimal32 vs unsigned int.
  • bool operator!= (decimal32 __lhs, unsigned long __rhs) โ€” decimal32 vs unsigned long.
  • bool operator!= (decimal32 __lhs, unsigned long long __rhs) โ€” decimal32 vs unsigned long long.

and now decimal64 takes the wheel:

  • bool operator!= (decimal64 __lhs, decimal128 __rhs) โ€” decimal64 vs decimal128.
  • bool operator!= (decimal64 __lhs, decimal32 __rhs) โ€” decimal64 vs decimal32.
  • bool operator!= (decimal64 __lhs, decimal64 __rhs) โ€” decimal64 vs decimal64.
  • bool operator!= (decimal64 __lhs, int __rhs) โ€” decimal64 vs int.
  • bool operator!= (decimal64 __lhs, long __rhs) โ€” decimal64 vs long.
  • bool operator!= (decimal64 __lhs, long long __rhs) โ€” decimal64 vs long long.
  • bool operator!= (decimal64 __lhs, unsigned int __rhs) โ€” decimal64 vs unsigned int.
  • bool operator!= (decimal64 __lhs, unsigned long __rhs) โ€” decimal64 vs unsigned long.
  • bool operator!= (decimal64 __lhs, unsigned long long __rhs) โ€” decimal64 vs unsigned long long.

flip it! integral type on the left, decimal on the right:

  • bool operator!= (int __lhs, decimal128 __rhs) โ€” int vs decimal128.
  • bool operator!= (int __lhs, decimal32 __rhs) โ€” int vs decimal32.
  • bool operator!= (int __lhs, decimal64 __rhs) โ€” int vs decimal64.
  • bool operator!= (long __lhs, decimal128 __rhs) โ€” long vs decimal128.
  • bool operator!= (long __lhs, decimal32 __rhs) โ€” long vs decimal32.
  • bool operator!= (long __lhs, decimal64 __rhs) โ€” long vs decimal64.
  • bool operator!= (long long __lhs, decimal128 __rhs) โ€” long long vs decimal128.
  • bool operator!= (long long __lhs, decimal32 __rhs) โ€” long long vs decimal32.
  • bool operator!= (long long __lhs, decimal64 __rhs) โ€” long long vs decimal64.
  • bool operator!= (unsigned int __lhs, decimal128 __rhs) โ€” unsigned int vs decimal128.
  • bool operator!= (unsigned int __lhs, decimal32 __rhs) โ€” unsigned int vs decimal32.
  • bool operator!= (unsigned int __lhs, decimal64 __rhs) โ€” unsigned int vs decimal64.
  • bool operator!= (unsigned long __lhs, decimal128 __rhs) โ€” unsigned long vs decimal128.
  • bool operator!= (unsigned long __lhs, decimal32 __rhs) โ€” unsigned long vs decimal32.
  • bool operator!= (unsigned long __lhs, decimal64 __rhs) โ€” unsigned long vs decimal64.
  • bool operator!= (unsigned long long __lhs, decimal128 __rhs) โ€” unsigned long long vs decimal128.
  • bool operator!= (unsigned long long __lhs, decimal32 __rhs) โ€” unsigned long long vs decimal32.
  • bool operator!= (unsigned long long __lhs, decimal64 __rhs) โ€” unsigned long long vs decimal64. done. that's all of them. breathe. ๐Ÿ˜ฎโ€๐Ÿ’จ

๐Ÿ”ฅ operator* โ€” multiply era

heads up: the return type is not always the biggest type. read the signature, bestie, it's right there. ๐Ÿ‘‘

  • decimal128 operator* (decimal128 __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, decimal32 __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, decimal64 __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, int __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, long __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, long long __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, unsigned int __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, unsigned long __rhs) โ†’ decimal128
  • decimal128 operator* (decimal128 __lhs, unsigned long long __rhs) โ†’ decimal128
  • decimal128 operator* (decimal32 __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (decimal32 __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (decimal32 __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal32 operator* (decimal32 __lhs, int __rhs) โ†’ decimal32
  • decimal32 operator* (decimal32 __lhs, long __rhs) โ†’ decimal32
  • decimal32 operator* (decimal32 __lhs, long long __rhs) โ†’ decimal32
  • decimal32 operator* (decimal32 __lhs, unsigned int __rhs) โ†’ decimal32
  • decimal32 operator* (decimal32 __lhs, unsigned long __rhs) โ†’ decimal32
  • decimal32 operator* (decimal32 __lhs, unsigned long long __rhs) โ†’ decimal32
  • decimal128 operator* (decimal64 __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal64 operator* (decimal64 __lhs, decimal32 __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, int __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, long __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, long long __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, unsigned int __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, unsigned long __rhs) โ†’ decimal64
  • decimal64 operator* (decimal64 __lhs, unsigned long long __rhs) โ†’ decimal64
  • decimal128 operator* (int __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (int __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (int __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal128 operator* (long __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (long __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (long __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal128 operator* (long long __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (long long __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (long long __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal128 operator* (unsigned int __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (unsigned int __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (unsigned int __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal128 operator* (unsigned long __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (unsigned long __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (unsigned long __lhs, decimal64 __rhs) โ†’ decimal64
  • decimal128 operator* (unsigned long long __lhs, decimal128 __rhs) โ†’ decimal128
  • decimal32 operator* (unsigned long long __lhs, decimal32 __rhs) โ†’ decimal32
  • decimal64 operator* (unsigned long long __lhs, decimal64 __rhs) โ†’ decimal64

โœจ operator+ โ€” add era (now with unary!!)

  • decimal128 operator+ (decimal128 __lhs, decimal128 __rhs)
  • decimal128 operator+ (decimal128 __lhs, decimal32 __rhs)
  • decimal128 operator+ (decimal128 __lhs, decimal64 __rhs)
  • decimal128 operator+ (decimal128 __lhs, int __rhs)
  • decimal128 operator+ (decimal128 __lhs, long __rhs)
  • decimal128 operator+ (decimal128 __lhs, long long __rhs)
  • decimal128 operator+ (decimal128 __lhs, unsigned int __rhs)
  • decimal128 operator+ (decimal128 __lhs, unsigned long __rhs)
  • decimal128 operator+ (decimal128 __lhs, unsigned long long __rhs)
  • decimal128 operator+ (decimal128 __rhs) โ€” โš ๏ธ look, only one argument: this is the unary plus, and it returns decimal128.
  • decimal128 operator+ (decimal32 __lhs, decimal128 __rhs)
  • decimal32 operator+ (decimal32 __lhs, decimal32 __rhs)
  • decimal64 operator+ (decimal32 __lhs, decimal64 __rhs)
  • decimal32 operator+ (decimal32 __lhs, int __rhs)
  • decimal32 operator+ (decimal32 __lhs, long __rhs)
  • decimal32 operator+ (decimal32 __lhs, long long __rhs)
  • decimal32 operator+ (decimal32 __lhs, unsigned int __rhs)
  • decimal32 operator+ (decimal32 __lhs, unsigned long __rhs)
  • decimal32 operator+ (decimal32 __lhs, unsigned long long __rhs)
  • decimal32 operator+ (decimal32 __rhs) โ€” unary plus again, this time decimal32.
  • decimal128 operator+ (decimal64 __lhs, decimal128 __rhs)
  • decimal64 operator+ (decimal64 __lhs, decimal32 __rhs)
  • decimal64 operator+ (decimal64 __lhs, decimal64 __rhs)
  • decimal64 operator+ (decimal64 __lhs, int __rhs)
  • decimal64 operator+ (decimal64 __lhs, long __rhs)
  • decimal64 operator+ (decimal64 __lhs, long long __rhs)
  • decimal64 operator+ (decimal64 __lhs, unsigned int __rhs)
  • decimal64 operator+ (decimal64 __lhs, unsigned long __rhs)
  • decimal64 operator+ (decimal64 __lhs, unsigned long long __rhs)
  • decimal64 operator+ (decimal64 __rhs) โ€” third unary plus, decimal64 flavoured.
  • decimal128 operator+ (int __lhs, decimal128 __rhs)
  • decimal32 operator+ (int __lhs, decimal32 __rhs)
  • decimal64 operator+ (int __lhs, decimal64 __rhs)
  • decimal128 operator+ (long __lhs, decimal128 __rhs)
  • decimal32 operator+ (long __lhs, decimal32 __rhs)
  • decimal64 operator+ (long __lhs, decimal64 __rhs)
  • decimal128 operator+ (long long __lhs, decimal128 __rhs)
  • decimal32 operator+ (long long __lhs, decimal32 __rhs)
  • decimal64 operator+ (long long __lhs, decimal64 __rhs)
  • decimal128 operator+ (unsigned int __lhs, decimal128 __rhs)
  • decimal32 operator+ (unsigned int __lhs, decimal32 __rhs)
  • decimal64 operator+ (unsigned int __lhs, decimal64 __rhs)
  • decimal128 operator+ (unsigned long __lhs, decimal128 __rhs)
  • decimal32 operator+ (unsigned long __lhs, decimal32 __rhs)
  • decimal64 operator+ (unsigned long __lhs, decimal64 __rhs)
  • decimal128 operator+ (unsigned long long __lhs, decimal128 __rhs)
  • decimal32 operator+ (unsigned long long __lhs, decimal32 __rhs)
  • decimal64 operator+ (unsigned long long __lhs, decimal64 __rhs)

๐Ÿ’œ operator- โ€” subtraction era (unary minus said hi too)

  • decimal128 operator- (decimal128 __lhs, decimal128 __rhs)
  • decimal128 operator- (decimal128 __lhs, decimal32 __rhs)
  • decimal128 operator- (decimal128 __lhs, decimal64 __rhs)
  • decimal128 operator- (decimal128 __lhs, int __rhs)
  • decimal128 operator- (decimal128 __lhs, long __rhs)
  • decimal128 operator- (decimal128 __lhs, long long __rhs)
  • decimal128 operator- (decimal128 __lhs, unsigned int __rhs)
  • decimal128 operator- (decimal128 __lhs, unsigned long __rhs)
  • decimal128 operator- (decimal128 __lhs, unsigned long long __rhs)
  • decimal128 operator- (decimal128 __rhs) โ€” unary minus, single arg, returns decimal128. negation slay.
  • decimal128 operator- (decimal32 __lhs, decimal128 __rhs)
  • decimal32 operator- (decimal32 __lhs, decimal32 __rhs)
  • decimal64 operator- (decimal32 __lhs, decimal64 __rhs)
  • decimal32 operator- (decimal32 __lhs, int __rhs)
  • decimal32 operator- (decimal32 __lhs, long __rhs)
  • decimal32 operator- (decimal32 __lhs, long long __rhs)
  • decimal32 operator- (decimal32 __lhs, unsigned int __rhs)
  • decimal32 operator- (decimal32 __lhs, unsigned long __rhs)
  • decimal32 operator- (decimal32 __lhs, unsigned long long __rhs)
  • decimal32 operator- (decimal32 __rhs) โ€” unary minus for decimal32.
  • decimal128 operator- (decimal64 __lhs, decimal128 __rhs)
  • decimal64 operator- (decimal64 __lhs, decimal32 __rhs)
  • decimal64 operator- (decimal64 __lhs, decimal64 __rhs)
  • decimal64 operator- (decimal64 __lhs, int __rhs)
  • decimal64 operator- (decimal64 __lhs, long __rhs)
  • decimal64 operator- (decimal64 __lhs, long long __rhs)
  • decimal64 operator- (decimal64 __lhs, unsigned int __rhs)

okay so we're picking up mid-roster on operator- โ€” the minus squad continues, and yes every single one of these bad boys gets its own line ๐Ÿ’…

decimal64 operator- (decimal64 __lhs, unsigned long __rhs)
decimal64 operator- (decimal64 __lhs, unsigned long long __rhs)
decimal64 operator- (decimal64 __rhs)
decimal128 operator- (int __lhs, decimal128 __rhs)
decimal32 operator- (int __lhs, decimal32 __rhs)
decimal64 operator- (int __lhs, decimal64 __rhs)
decimal128 operator- (long __lhs, decimal128 __rhs)
decimal32 operator- (long __lhs, decimal32 __rhs)
decimal64 operator- (long __lhs, decimal64 __rhs)
decimal128 operator- (long long __lhs, decimal128 __rhs)
decimal32 operator- (long long __lhs, decimal32 __rhs)
decimal64 operator- (long long __lhs, decimal64 __rhs)
decimal128 operator- (unsigned int __lhs, decimal128 __rhs)
decimal32 operator- (unsigned int __lhs, decimal32 __rhs)
decimal64 operator- (unsigned int __lhs, decimal64 __rhs)
decimal128 operator- (unsigned long __lhs, decimal128 __rhs)
decimal32 operator- (unsigned long __lhs, decimal32 __rhs)
decimal64 operator- (unsigned long __lhs, decimal64 __rhs)
decimal128 operator- (unsigned long long __lhs, decimal128 __rhs)
decimal32 operator- (unsigned long long __lhs, decimal32 __rhs)
decimal64 operator- (unsigned long long __lhs, decimal64 __rhs)

spotted the icon: decimal64 operator- (decimal64 __rhs) is the unary one โ€” single argument, no __lhs, she's out here doing straight-up negation all by herself ๐Ÿซถ

and that's the whole minus family, wrapped and done. periodt.


next up: division โœจ the operator/ set is thicc โ€” big main character energy, nine whole lines just for decimal128 on the left alone. here she is ๐Ÿ’–

decimal128 operator/ (decimal128 __lhs, decimal128 __rhs)
decimal128 operator/ (decimal128 __lhs, decimal32 __rhs)
decimal128 operator/ (decimal128 __lhs, decimal64 __rhs)
decimal128 operator/ (decimal128 __lhs, int __rhs)
decimal128 operator/ (decimal128 __lhs, long __rhs)
decimal128 operator/ (decimal128 __lhs, long long __rhs)
decimal128 operator/ (decimal128 __lhs, unsigned int __rhs)
decimal128 operator/ (decimal128 __lhs, unsigned long __rhs)
decimal128 operator/ (decimal128 __lhs, unsigned long long __rhs)
decimal128 operator/ (decimal32 __lhs, decimal128 __rhs)
decimal32 operator/ (decimal32 __lhs, decimal32 __rhs)
decimal64 operator/ (decimal32 __lhs, decimal64 __rhs)
decimal32 operator/ (decimal32 __lhs, int __rhs)
decimal32 operator/ (decimal32 __lhs, long __rhs)
decimal32 operator/ (decimal32 __lhs, long long __rhs)
decimal32 operator/ (decimal32 __lhs, unsigned int __rhs)
decimal32 operator/ (decimal32 __lhs, unsigned long __rhs)
decimal32 operator/ (decimal32 __lhs, unsigned long long __rhs)
decimal128 operator/ (decimal64 __lhs, decimal128 __rhs)
decimal64 operator/ (decimal64 __lhs, decimal32 __rhs)
decimal64 operator/ (decimal64 __lhs, decimal64 __rhs)
decimal64 operator/ (decimal64 __lhs, int __rhs)
decimal64 operator/ (decimal64 __lhs, long __rhs)
decimal64 operator/ (decimal64 __lhs, long long __rhs)
decimal64 operator/ (decimal64 __lhs, unsigned int __rhs)
decimal64 operator/ (decimal64 __lhs, unsigned long __rhs)
decimal64 operator/ (decimal64 __lhs, unsigned long long __rhs)
decimal128 operator/ (int __lhs, decimal128 __rhs)
decimal32 operator/ (int __lhs, decimal32 __rhs)
decimal64 operator/ (int __lhs, decimal64 __rhs)
decimal128 operator/ (long __lhs, decimal128 __rhs)
decimal32 operator/ (long __lhs, decimal32 __rhs)
decimal64 operator/ (long __lhs, decimal64 __rhs)
decimal128 operator/ (long long __lhs, decimal128 __rhs)
decimal32 operator/ (long long __lhs, decimal32 __rhs)
decimal64 operator/ (long long __lhs, decimal64 __rhs)
decimal128 operator/ (unsigned int __lhs, decimal128 __rhs)
decimal32 operator/ (unsigned int __lhs, decimal32 __rhs)
decimal64 operator/ (unsigned int __lhs, decimal64 __rhs)
decimal128 operator/ (unsigned long __lhs, decimal128 __rhs)
decimal32 operator/ (unsigned long __lhs, decimal32 __rhs)
decimal64 operator/ (unsigned long __lhs, decimal64 __rhs)
decimal128 operator/ (unsigned long long __lhs, decimal128 __rhs)
decimal32 operator/ (unsigned long long __lhs, decimal32 __rhs)
decimal64 operator/ (unsigned long long __lhs, decimal64 __rhs)

ngl bestie, look at that return-type glow-up: when the two sides don't match, the answer levels up to the bigger of the two โ€” decimal32 รท decimal64 gives you a decimal64, decimal32 รท decimal128 gives you a decimal128, decimal64 รท decimal128 gives you a decimal128. and when both sides are the same type? you get that type right back. the way it just scales ๐Ÿ˜ญ๐Ÿ‘‘


comparison time babes ๐ŸŒˆ operator< returns a good ol' bool โ€” no decimal nonsense, just yes-or-no, true-or-false, ate-or-didn't ๐Ÿ’€

bool operator< (decimal128 __lhs, decimal128 __rhs)
bool operator< (decimal128 __lhs, decimal32 __rhs)
bool operator< (decimal128 __lhs, decimal64 __rhs)
bool operator< (decimal128 __lhs, int __rhs)
bool operator< (decimal128 __lhs, long __rhs)
bool operator< (decimal128 __lhs, long long __rhs)
bool operator< (decimal128 __lhs, unsigned int __rhs)
bool operator< (decimal128 __lhs, unsigned long __rhs)
bool operator< (decimal128 __lhs, unsigned long long __rhs)
bool operator< (decimal32 __lhs, decimal128 __rhs)
bool operator< (decimal32 __lhs, decimal32 __rhs)
bool operator< (decimal32 __lhs, decimal64 __rhs)
bool operator< (decimal32 __lhs, int __rhs)
bool operator< (decimal32 __lhs, long __rhs)
bool operator< (decimal32 __lhs, long long __rhs)
bool operator< (decimal32 __lhs, unsigned int __rhs)
bool operator< (decimal32 __lhs, unsigned long __rhs)
bool operator< (decimal32 __lhs, unsigned long long __rhs)
bool operator< (decimal64 __lhs, decimal128 __rhs)
bool operator< (decimal64 __lhs, decimal32 __rhs)
bool operator< (decimal64 __lhs, decimal64 __rhs)
bool operator< (decimal64 __lhs, int __rhs)
bool operator< (decimal64 __lhs, long __rhs)
bool operator< (decimal64 __lhs, long long __rhs)
bool operator< (decimal64 __lhs, unsigned int __rhs)
bool operator< (decimal64 __lhs, unsigned long __rhs)
bool operator< (decimal64 __lhs, unsigned long long __rhs)
bool operator< (int __lhs, decimal128 __rhs)
bool operator< (int __lhs, decimal32 __rhs)
bool operator< (int __lhs, decimal64 __rhs)
bool operator< (long __lhs, decimal128 __rhs)
bool operator< (long __lhs, decimal32 __rhs)
bool operator< (long __lhs, decimal64 __rhs)
bool operator< (long long __lhs, decimal128 __rhs)
bool operator< (long long __lhs, decimal32 __rhs)
bool operator< (long long __lhs, decimal64 __rhs)
bool operator< (unsigned int __lhs, decimal128 __rhs)
bool operator< (unsigned int __lhs, decimal32 __rhs)
bool operator< (unsigned int __lhs, decimal64 __rhs)
bool operator< (unsigned long __lhs, decimal128 __rhs)
bool operator< (unsigned long __lhs, decimal32 __rhs)
bool operator< (unsigned long __lhs, decimal64 __rhs)
bool operator< (unsigned long long __lhs, decimal128 __rhs)
bool operator< (unsigned long long __lhs, decimal32 __rhs)
bool operator< (unsigned long long __lhs, decimal64 __rhs)

notice it goes both directions โ€” int on the left with a decimal on the right and decimal on the left with int on the right, because the compiler doesn't know which one you meant and honestly? she's just being polite ๐Ÿ’…


and now the equality girlies ๐ŸŽ€ operator==, same bool return, same exhaustive energy, same 45 lines of "what if it's this type tho":

bool operator== (decimal128 __lhs, decimal128 __rhs)
bool operator== (decimal128 __lhs, decimal32 __rhs)
bool operator== (decimal128 __lhs, decimal64 __rhs)
bool operator== (decimal128 __lhs, int __rhs)
bool operator== (decimal128 __lhs, long __rhs)
bool operator== (decimal128 __lhs, long long __rhs)
bool operator== (decimal128 __lhs, unsigned int __rhs)
bool operator== (decimal128 __lhs, unsigned long __rhs)
bool operator== (decimal128 __lhs, unsigned long long __rhs)
bool operator== (decimal32 __lhs, decimal128 __rhs)
bool operator== (decimal32 __lhs, decimal32 __rhs)
bool operator== (decimal32 __lhs, decimal64 __rhs)
bool operator== (decimal32 __lhs, int __rhs)
bool operator== (decimal32 __lhs, long __rhs)
bool operator== (decimal32 __lhs, long long __rhs)
bool operator== (decimal32 __lhs, unsigned int __rhs)
bool operator== (decimal32 __lhs, unsigned long __rhs)
bool operator== (decimal32 __lhs, unsigned long long __rhs)
bool operator== (decimal64 __lhs, decimal128 __rhs)
bool operator== (decimal64 __lhs, decimal32 __rhs)
bool operator== (decimal64 __lhs, decimal64 __rhs)
bool operator== (decimal64 __lhs, int __rhs)
bool operator== (decimal64 __lhs, long __rhs)
bool operator== (decimal64 __lhs, long long __rhs)
bool operator== (decimal64 __lhs, unsigned int __rhs)
bool operator== (decimal64 __lhs, unsigned long __rhs)
bool operator== (decimal64 __lhs, unsigned long long __rhs)
bool operator== (int __lhs, decimal128 __rhs)
bool operator== (int __lhs, decimal32 __rhs)
bool operator== (int __lhs, decimal64 __rhs)
bool operator== (long __lhs, decimal128 __rhs)
bool operator== (long __lhs, decimal32 __rhs)
bool operator== (long __lhs, decimal64 __rhs)
bool operator== (long long __lhs, decimal128 __rhs)
bool operator== (long long __lhs, decimal32 __rhs)
bool operator== (long long __lhs, decimal64 __rhs)
bool operator== (unsigned int __lhs, decimal128 __rhs)
bool operator== (unsigned int __lhs, decimal32 __rhs)
bool operator== (unsigned int __lhs, decimal64 __rhs)
bool operator== (unsigned long __lhs, decimal128 __rhs)
bool operator== (unsigned long __lhs, decimal32 __rhs)
bool operator== (unsigned long __lhs, decimal64 __rhs)
bool operator== (unsigned long long __lhs, decimal128 __rhs)
bool operator== (unsigned long long __lhs, decimal32 __rhs)
bool operator== (unsigned long long __lhs, decimal64 __rhs)

and we're ending this part on operator> โญ โ€” the "greater than" crew, doing the exact same dance as < except the other way around. she's mid-roll call so don't go anywhere ๐Ÿ™ˆ

bool operator> (decimal128 __lhs, decimal128 __rhs)
bool operator> (decimal128 __lhs, decimal32 __rhs)
bool operator> (decimal128 __lhs, decimal64 __rhs)
bool operator> (decimal128 __lhs, int __rhs)
bool operator> (decimal128 __lhs, long __rhs)
bool operator> (decimal128 __lhs, long long __rhs)
bool operator> (decimal128 __lhs, unsigned int __rhs)
bool operator> (decimal128 __lhs, unsigned long __rhs)
bool operator> (decimal128 __lhs, unsigned long long __rhs)
bool operator> (decimal32 __lhs, decimal128 __rhs)
bool operator> (decimal32 __lhs, decimal32 __rhs)
bool operator> (decimal32 __lhs, decimal64 __rhs)
bool operator> (decimal32 __lhs, int __rhs)
bool operator> (decimal32 __lhs, long __rhs)
bool operator> (decimal32 __lhs, long long __rhs)
bool operator> (decimal32 __lhs, unsigned int __rhs)
bool operator> (decimal32 __lhs, unsigned long __rhs)
bool operator> (decimal32 __lhs, unsigned long long __rhs)
bool operator> (decimal64 __lhs, decimal128 __rhs)
bool operator> (decimal64 __lhs, decimal32 __rhs)
bool operator> (decimal64 __lhs, decimal64 __rhs)
bool operator> (decimal64 __lhs, int __rhs)
bool operator> (decimal64 __lhs, long __rhs)
bool operator> (decimal64 __lhs, long long __rhs)
bool operator> (decimal64 __lhs, unsigned int __rhs)
bool operator> (decimal64 __lhs, unsigned long __rhs)
bool operator> (decimal64 __lhs, unsigned long long __rhs)
bool operator> (int __lhs, decimal128 __rhs)
bool operator> (int __lhs, decimal32 __rhs)
bool operator> (int __lhs, decimal64 __rhs)
bool operator> (long __lhs, decimal128 __rhs)
bool operator> (long __lhs, decimal32 __rhs)
bool operator> (long __lhs, decimal64 __rhs)
bool operator> (long long __lhs, decimal128 __rhs)
bool operator> (long long __lhs, decimal32 __rhs)
bool operator> (long long __lhs, decimal64 __rhs)
bool operator> (unsigned int __lhs, decimal128 __rhs)
bool operator> (unsigned int __lhs, decimal32 __rhs)
bool operator> (unsigned int __lhs, decimal64 __rhs)
bool operator> (unsigned long __lhs, decimal128 __rhs)
bool operator> (unsigned long __lhs, decimal32 __rhs)
bool operator> (unsigned long __lhs, decimal64 __rhs)
bool operator> (unsigned long long __lhs, decimal128 __rhs)
bool operator> (unsigned long long __lhs, decimal32 __rhs)

still rolling, bestie โ€” more coming ๐Ÿ’–

...and bestie, we are SO close to the end of this operator wall. Like, we've been scrolling for hours and my thumbs hurt, but the >= squad deserves its moment too, okay? One straggler > first (fashionably late, honestly iconic of it), then every single >= pairing in existence. No cap, they really did type out all of them:

bool operator> (unsigned long long __lhs, decimal64 __rhs)
bool operator>= (decimal128 __lhs, decimal128 __rhs)
bool operator>= (decimal128 __lhs, decimal32 __rhs)
bool operator>= (decimal128 __lhs, decimal64 __rhs)
bool operator>= (decimal128 __lhs, int __rhs)
bool operator>= (decimal128 __lhs, long __rhs)
bool operator>= (decimal128 __lhs, long long __rhs)
bool operator>= (decimal128 __lhs, unsigned int __rhs)
bool operator>= (decimal128 __lhs, unsigned long __rhs)
bool operator>= (decimal128 __lhs, unsigned long long __rhs)
bool operator>= (decimal32 __lhs, decimal128 __rhs)
bool operator>= (decimal32 __lhs, decimal32 __rhs)
bool operator>= (decimal32 __lhs, decimal64 __rhs)
bool operator>= (decimal32 __lhs, int __rhs)
bool operator>= (decimal32 __lhs, long __rhs)
bool operator>= (decimal32 __lhs, long long __rhs)
bool operator>= (decimal32 __lhs, unsigned int __rhs)
bool operator>= (decimal32 __lhs, unsigned long __rhs)
bool operator>= (decimal32 __lhs, unsigned long long __rhs)
bool operator>= (decimal64 __lhs, decimal128 __rhs)
bool operator>= (decimal64 __lhs, decimal32 __rhs)
bool operator>= (decimal64 __lhs, decimal64 __rhs)
bool operator>= (decimal64 __lhs, int __rhs)
bool operator>= (decimal64 __lhs, long __rhs)
bool operator>= (decimal64 __lhs, long long __rhs)
bool operator>= (decimal64 __lhs, unsigned int __rhs)
bool operator>= (decimal64 __lhs, unsigned long __rhs)
bool operator>= (decimal64 __lhs, unsigned long long __rhs)
bool operator>= (int __lhs, decimal128 __rhs)
bool operator>= (int __lhs, decimal32 __rhs)
bool operator>= (int __lhs, decimal64 __rhs)
bool operator>= (long __lhs, decimal128 __rhs)
bool operator>= (long __lhs, decimal32 __rhs)
bool operator>= (long __lhs, decimal64 __rhs)
bool operator>= (long long __lhs, decimal128 __rhs)
bool operator>= (long long __lhs, decimal32 __rhs)
bool operator>= (long long __lhs, decimal64 __rhs)
bool operator>= (unsigned int __lhs, decimal128 __rhs)
bool operator>= (unsigned int __lhs, decimal32 __rhs)
bool operator>= (unsigned int __lhs, decimal64 __rhs)
bool operator>= (unsigned long __lhs, decimal128 __rhs)
bool operator>= (unsigned long __lhs, decimal32 __rhs)
bool operator>= (unsigned long __lhs, decimal64 __rhs)
bool operator>= (unsigned long long __lhs, decimal128 __rhs)
bool operator>= (unsigned long long __lhs, decimal32 __rhs)
bool operator>= (unsigned long long __lhs, decimal64 __rhs)

Right?? Every decimal32 / decimal64 / decimal128 combo with each other, and with int, long, long long, unsigned int, unsigned long, unsigned long long โ€” both directions, __lhs and __rhs โ€” and every single one hands you back a bool. It's giving "we will not let you write a comparison that doesn't compile." Obsessed. ๐Ÿ”ฅ


๐Ÿฆ‹ DETAILED DESCRIPTION ๐Ÿฆ‹

ISO/IEC TR 24733 Decimal floating-point arithmetic.

That's the whole vibe, bestie โ€” this whole header is the implementation of that ISO/IEC TR 24733 decimal floating-point arithmetic spec. That's the standard, that's the assignment, that's the moment. โœจ


๐ŸŒˆ FUNCTION DOCUMENTATION ๐ŸŒˆ

๐ŸŽ€ long long std::decimal::decimal32_to_long_long (decimal32 __d)

K so this one is a non-conforming extension โ€” meaning it's a little bonus the library hands you that's not part of the conforming spec. Read that again, because I need you to know it before you build your whole personality on it: non-conforming extension. It does a conversion to integral type.

References: std::operator+(), and std::operator-(). Those are the two it name-drops, so write them down in your notes app alongside your crush's birthday. ๐Ÿ“๐Ÿ’–


๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

Generated automatically by Doxygen for libstdc++ from the source code.

I know. Nobody hand-wrote this masterpiece โ€” the robot did it, and honestly? Slay, little Doxygen. ๐Ÿ’…


And that's a wrap on std::decimal(3cxx), bestie!! Courtesy of libstdc++ and its humble servant Doxygen, filed under section 3cxx in your friendly neighborhood man pages. Go forth and compare decimals responsibly. ๐Ÿซถ๐Ÿ“๐Ÿ’œ

๐Ÿ“ฆ where this page comes from