# decimal

Go to the documentation of this file.

    00001 // <decimal> -*- C++ -*-
    00002
    00003 // Copyright (C) 2009 Free Software Foundation, Inc.
    00004 // This file is part of the GNU ISO C++ Library.  This library is free
    00005 // software; you can redistribute it and/or modify it under the
    00006 // terms of the GNU General Public License as published by the
    00007 // Free Software Foundation; either version 3, or (at your option)
    00008 // any later version.
    00009
    00010 // This library is distributed in the hope that it will be useful,
    00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00013 // GNU General Public License for more details.
    00014
    00015 // Under Section 7 of GPL version 3, you are granted additional
    00016 // permissions described in the GCC Runtime Library Exception, version
    00017 // 3.1, as published by the Free Software Foundation.
    00018
    00019 // You should have received a copy of the GNU General Public License and
    00020 // a copy of the GCC Runtime Library Exception along with this program;
    00021 // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    00022 // <http://www.gnu.org/licenses/>.
    00023
    00024 /** @file include/decimal/decimal
    00025  *  This is a Standard C++ Library header.
    00026  */
    00027
    00028 // ISO/IEC TR 24733
    00029 // Written by Janis Johnson <janis187@us.ibm.com>
    00030
    00031 #ifndef _GLIBCXX_DECIMAL
    00032 #define _GLIBCXX_DECIMAL 1
    00033
    00034 #pragma GCC system_header
    00035
    00036 #include <bits/c++config.h>
    00037
    00038 #ifndef _GLIBCXX_USE_DECIMAL_FLOAT
    00039 #error This file requires compiler and library support for ISO/IEC TR 24733 \
    00040 that is currently not available.
    00041 #endif
    00042
    00043 namespace std
    00044 {
    00045   /**
    00046     * @defgroup decimal Decimal Floating-Point Arithmetic
    00047     * @ingroup numerics
    00048     *
    00049     * Classes and functions for decimal floating-point arithmetic.
    00050     * @{
    00051     */
    00052
    00053   /** @namespace std::decimal
    00054     * @brief ISO/IEC TR 24733 Decimal floating-point arithmetic.
    00055     */
    00056 namespace decimal
    00057 {
    00058   class decimal32;
    00059   class decimal64;
    00060   class decimal128;
    00061
    00062   // 3.2.5  Initialization from coefficient and exponent.
    00063   static decimal32 make_decimal32(long long __coeff, int __exp);
    00064   static decimal32 make_decimal32(unsigned long long __coeff, int __exp);
    00065   static decimal64 make_decimal64(long long __coeff, int __exp);
    00066   static decimal64 make_decimal64(unsigned long long __coeff, int __exp);
    00067   static decimal128 make_decimal128(long long __coeff, int __exp);
    00068   static decimal128 make_decimal128(unsigned long long __coeff, int __exp);
    00069
    00070   /// Non-conforming extension: Conversion to integral type.
    00071   long long decimal32_to_long_long(decimal32 __d);
    00072   long long decimal64_to_long_long(decimal64 __d);
    00073   long long decimal128_to_long_long(decimal128 __d);
    00074   long long decimal_to_long_long(decimal32 __d);
    00075   long long decimal_to_long_long(decimal64 __d);
    00076   long long decimal_to_long_long(decimal128 __d);
    00077
    00078   // 3.2.6  Conversion to generic floating-point type.
    00079   float decimal32_to_float(decimal32 __d);
    00080   float decimal64_to_float(decimal64 __d);
    00081   float decimal128_to_float(decimal128 __d);
    00082   float decimal_to_float(decimal32 __d);
    00083   float decimal_to_float(decimal64 __d);
    00084   float decimal_to_float(decimal128 __d);
    00085
    00086   double decimal32_to_double(decimal32 __d);
    00087   double decimal64_to_double(decimal64 __d);
    00088   double decimal128_to_double(decimal128 __d);
    00089   double decimal_to_double(decimal32 __d);
    00090   double decimal_to_double(decimal64 __d);
    00091   double decimal_to_double(decimal128 __d);
    00092
    00093   long double decimal32_to_long_double(decimal32 __d);
    00094   long double decimal64_to_long_double(decimal64 __d);
    00095   long double decimal128_to_long_double(decimal128 __d);
    00096   long double decimal_to_long_double(decimal32 __d);
    00097   long double decimal_to_long_double(decimal64 __d);
    00098   long double decimal_to_long_double(decimal128 __d);
    00099
    00100   // 3.2.7  Unary arithmetic operators.
    00101   decimal32  operator+(decimal32 __rhs);
    00102   decimal64  operator+(decimal64 __rhs);
    00103   decimal128 operator+(decimal128 __rhs);
    00104   decimal32  operator-(decimal32 __rhs);
    00105   decimal64  operator-(decimal64 __rhs);
    00106   decimal128 operator-(decimal128 __rhs);
    00107
    00108   // 3.2.8  Binary arithmetic operators.
    00109 #define _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(_Op, _T1, _T2, _T3) \
    00110   _T1 operator _Op(_T2 __lhs, _T3 __rhs);
    00111 #define _DECLARE_DECIMAL_BINARY_OP_WITH_INT(_Op, _Tp)       \
    00112   _Tp operator _Op(_Tp __lhs, int __rhs);           \
    00113   _Tp operator _Op(_Tp __lhs, unsigned int __rhs);      \
    00114   _Tp operator _Op(_Tp __lhs, long __rhs);          \
    00115   _Tp operator _Op(_Tp __lhs, unsigned long __rhs);     \
    00116   _Tp operator _Op(_Tp __lhs, long long __rhs);         \
    00117   _Tp operator _Op(_Tp __lhs, unsigned long long __rhs);    \
    00118   _Tp operator _Op(int __lhs, _Tp __rhs);           \
    00119   _Tp operator _Op(unsigned int __lhs, _Tp __rhs);      \
    00120   _Tp operator _Op(long __lhs, _Tp __rhs);          \
    00121   _Tp operator _Op(unsigned long __lhs, _Tp __rhs);     \
    00122   _Tp operator _Op(long long __lhs, _Tp __rhs);         \
    00123   _Tp operator _Op(unsigned long long __lhs, _Tp __rhs);
    00124
    00125   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal32, decimal32, decimal32)
    00126   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal32)
    00127   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal32, decimal64)
    00128   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal32)
    00129   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal64, decimal64, decimal64)
    00130   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal64)
    00131   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal32, decimal128)
    00132   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal64, decimal128)
    00133   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal32)
    00134   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal64)
    00135   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(+, decimal128, decimal128, decimal128)
    00136   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(+, decimal128)
    00137
    00138   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal32, decimal32, decimal32)
    00139   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal32)
    00140   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal32, decimal64)
    00141   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal32)
    00142   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal64, decimal64, decimal64)
    00143   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal64)
    00144   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal32, decimal128)
    00145   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal64, decimal128)
    00146   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal32)
    00147   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal64)
    00148   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(-, decimal128, decimal128, decimal128)
    00149   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(-, decimal128)
    00150
    00151   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal32, decimal32, decimal32)
    00152   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal32)
    00153   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal32, decimal64)
    00154   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal32)
    00155   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal64, decimal64, decimal64)
    00156   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal64)
    00157   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal32, decimal128)
    00158   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal64, decimal128)
    00159   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal32)
    00160   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal64)
    00161   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(*, decimal128, decimal128, decimal128)
    00162   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(*, decimal128)
    00163
    00164   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal32, decimal32, decimal32)
    00165   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal32)
    00166   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal32, decimal64)
    00167   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal32)
    00168   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal64, decimal64, decimal64)
    00169   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal64)
    00170   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal32, decimal128)
    00171   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal64, decimal128)
    00172   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal32)
    00173   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal64)
    00174   _DECLARE_DECIMAL_BINARY_OP_WITH_DEC(/, decimal128, decimal128, decimal128)
    00175   _DECLARE_DECIMAL_BINARY_OP_WITH_INT(/, decimal128)
    00176
    00177 #undef _DECLARE_DECIMAL_BINARY_OP_WITH_DEC
    00178 #undef _DECLARE_DECIMAL_BINARY_OP_WITH_INT
    00179
    00180   // 3.2.9  Comparison operators.
    00181 #define _DECLARE_DECIMAL_COMPARISON(_Op, _Tp)               \
    00182   bool operator _Op(_Tp __lhs, decimal32 __rhs);            \
    00183   bool operator _Op(_Tp __lhs, decimal64 __rhs);            \
    00184   bool operator _Op(_Tp __lhs, decimal128 __rhs);           \
    00185   bool operator _Op(_Tp __lhs, int __rhs);              \
    00186   bool operator _Op(_Tp __lhs, unsigned int __rhs);         \
    00187   bool operator _Op(_Tp __lhs, long __rhs);             \
    00188   bool operator _Op(_Tp __lhs, unsigned long __rhs);            \
    00189   bool operator _Op(_Tp __lhs, long long __rhs);            \
    00190   bool operator _Op(_Tp __lhs, unsigned long long __rhs);       \
    00191   bool operator _Op(int __lhs, _Tp __rhs);              \
    00192   bool operator _Op(unsigned int __lhs, _Tp __rhs);         \
    00193   bool operator _Op(long __lhs, _Tp __rhs);             \
    00194   bool operator _Op(unsigned long __lhs, _Tp __rhs);            \
    00195   bool operator _Op(long long __lhs, _Tp __rhs);            \
    00196   bool operator _Op(unsigned long long __lhs, _Tp __rhs);
    00197
    00198   _DECLARE_DECIMAL_COMPARISON(==, decimal32)
    00199   _DECLARE_DECIMAL_COMPARISON(==, decimal64)
    00200   _DECLARE_DECIMAL_COMPARISON(==, decimal128)
    00201
    00202   _DECLARE_DECIMAL_COMPARISON(!=, decimal32)
    00203   _DECLARE_DECIMAL_COMPARISON(!=, decimal64)
    00204   _DECLARE_DECIMAL_COMPARISON(!=, decimal128)
    00205
    00206   _DECLARE_DECIMAL_COMPARISON(<, decimal32)
    00207   _DECLARE_DECIMAL_COMPARISON(<, decimal64)
    00208   _DECLARE_DECIMAL_COMPARISON(<, decimal128)
    00209
    00210   _DECLARE_DECIMAL_COMPARISON(>=, decimal32)
    00211   _DECLARE_DECIMAL_COMPARISON(>=, decimal64)
    00212   _DECLARE_DECIMAL_COMPARISON(>=, decimal128)
    00213
    00214   _DECLARE_DECIMAL_COMPARISON(>, decimal32)
    00215   _DECLARE_DECIMAL_COMPARISON(>, decimal64)
    00216   _DECLARE_DECIMAL_COMPARISON(>, decimal128)
    00217
    00218   _DECLARE_DECIMAL_COMPARISON(>=, decimal32)
    00219   _DECLARE_DECIMAL_COMPARISON(>=, decimal64)
    00220   _DECLARE_DECIMAL_COMPARISON(>=, decimal128)
    00221
    00222 #undef _DECLARE_DECIMAL_COMPARISON
    00223
    00224   /// 3.2.2  Class decimal32.
    00225   class decimal32
    00226   {
    00227   public:
    00228     typedef float __decfloat32 __attribute__((mode(SD)));
    00229
    00230     // 3.2.2.2  Construct/copy/destroy.
    00231     decimal32()                 : __val(0.e-101DF) {}
    00232
    00233     // 3.2.2.3  Conversion from floating-point type.
    00234     explicit decimal32(decimal64 __d64);
    00235     explicit decimal32(decimal128 __d128);
    00236     explicit decimal32(float __r)       : __val(__r) {}
    00237     explicit decimal32(double __r)      : __val(__r) {}
    00238     explicit decimal32(long double __r)     : __val(__r) {}
    00239
    00240     // 3.2.2.4  Conversion from integral type.
    00241     decimal32(int __z)              : __val(__z) {}
    00242     decimal32(unsigned int __z)         : __val(__z) {}
    00243     decimal32(long __z)             : __val(__z) {}
    00244     decimal32(unsigned long __z)        : __val(__z) {}
    00245     decimal32(long long __z)            : __val(__z) {}
    00246     decimal32(unsigned long long __z)       : __val(__z) {}
    00247
    00248     /// Conforming extension: Conversion from scalar decimal type.
    00249     decimal32(__decfloat32 __z)         : __val(__z) {}
    00250
    00251     // 3.2.2.5  Conversion to integral type. (DISABLED)
    00252     //operator long long() const { return (long long)__val; }
    00253
    00254     // 3.2.2.6  Increment and decrement operators.
    00255     decimal32& operator++()
    00256     {
    00257       __val += 1;
    00258       return *this;
    00259     }
    00260
    00261     decimal32 operator++(int)
    00262     {
    00263       decimal32 __tmp = *this;
    00264       __val += 1;
    00265       return __tmp;
    00266     }
    00267
    00268     decimal32& operator--()
    00269     {
    00270       __val -= 1;
    00271       return *this;
    00272     }
    00273
    00274     decimal32   operator--(int)
    00275     {
    00276       decimal32 __tmp = *this;
    00277       __val -= 1;
    00278       return __tmp;
    00279     }
    00280
    00281     // 3.2.2.7  Compound assignment.
    00282 #define _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(_Op) \
    00283     decimal32& operator _Op(decimal32 __rhs);       \
    00284     decimal32& operator _Op(decimal64 __rhs);       \
    00285     decimal32& operator _Op(decimal128 __rhs);      \
    00286     decimal32& operator _Op(int __rhs);         \
    00287     decimal32& operator _Op(unsigned int __rhs);    \
    00288     decimal32& operator _Op(long __rhs);        \
    00289     decimal32& operator _Op(unsigned long __rhs);   \
    00290     decimal32& operator _Op(long long __rhs);       \
    00291     decimal32& operator _Op(unsigned long long __rhs);
    00292
    00293     _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(+=)
    00294     _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(-=)
    00295     _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(*=)
    00296     _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT(/=)
    00297 #undef _DECLARE_DECIMAL32_COMPOUND_ASSIGNMENT
    00298
    00299   private:
    00300     __decfloat32 __val;
    00301
    00302   public:
    00303     __decfloat32 __getval(void) { return __val; }
    00304     void __setval(__decfloat32 __x) { __val = __x; }
    00305   };
    00306
    00307   /// 3.2.3  Class decimal64.
    00308   class decimal64
    00309   {
    00310   public:
    00311     typedef float __decfloat64 __attribute__((mode(DD)));
    00312
    00313     // 3.2.3.2  Construct/copy/destroy.
    00314     decimal64()                 : __val(0.e-398dd) {}
    00315
    00316     // 3.2.3.3  Conversion from floating-point type.
    00317          decimal64(decimal32 d32);
    00318     explicit decimal64(decimal128 d128);
    00319     explicit decimal64(float __r)       : __val(__r) {}
    00320     explicit decimal64(double __r)      : __val(__r) {}
    00321     explicit decimal64(long double __r)     : __val(__r) {}
    00322
    00323     // 3.2.3.4  Conversion from integral type.
    00324     decimal64(int __z)              : __val(__z) {}
    00325     decimal64(unsigned int __z)         : __val(__z) {}
    00326     decimal64(long __z)             : __val(__z) {}
    00327     decimal64(unsigned long __z)        : __val(__z) {}
    00328     decimal64(long long __z)            : __val(__z) {}
    00329     decimal64(unsigned long long __z)       : __val(__z) {}
    00330
    00331     /// Conforming extension: Conversion from scalar decimal type.
    00332     decimal64(__decfloat64 __z)         : __val(__z) {}
    00333
    00334     // 3.2.3.5  Conversion to integral type. (DISABLED)
    00335     //operator long long() const { return (long long)__val; }
    00336
    00337     // 3.2.3.6  Increment and decrement operators.
    00338     decimal64& operator++()
    00339     {
    00340       __val += 1;
    00341       return *this;
    00342     }
    00343
    00344     decimal64 operator++(int)
    00345     {
    00346       decimal64 __tmp = *this;
    00347       __val += 1;
    00348       return __tmp;
    00349     }
    00350
    00351     decimal64& operator--()
    00352     {
    00353       __val -= 1;
    00354       return *this;
    00355     }
    00356
    00357     decimal64 operator--(int)
    00358     {
    00359       decimal64 __tmp = *this;
    00360       __val -= 1;
    00361       return __tmp;
    00362     }
    00363
    00364     // 3.2.3.7  Compound assignment.
    00365 #define _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(_Op) \
    00366     decimal64& operator _Op(decimal32 __rhs);       \
    00367     decimal64& operator _Op(decimal64 __rhs);       \
    00368     decimal64& operator _Op(decimal128 __rhs);      \
    00369     decimal64& operator _Op(int __rhs);         \
    00370     decimal64& operator _Op(unsigned int __rhs);    \
    00371     decimal64& operator _Op(long __rhs);        \
    00372     decimal64& operator _Op(unsigned long __rhs);   \
    00373     decimal64& operator _Op(long long __rhs);       \
    00374     decimal64& operator _Op(unsigned long long __rhs);
    00375
    00376     _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(+=)
    00377     _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(-=)
    00378     _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(*=)
    00379     _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT(/=)
    00380 #undef _DECLARE_DECIMAL64_COMPOUND_ASSIGNMENT
    00381
    00382   private:
    00383     __decfloat64 __val;
    00384
    00385   public:
    00386     __decfloat64 __getval(void) { return __val; }
    00387     void __setval(__decfloat64 __x) { __val = __x; }
    00388   };
    00389
    00390   /// 3.2.4  Class decimal128.
    00391   class decimal128
    00392   {
    00393   public:
    00394     typedef float __decfloat128 __attribute__((mode(TD)));
    00395
    00396     // 3.2.4.2  Construct/copy/destroy.
    00397     decimal128()                : __val(0.e-6176DL) {}
    00398
    00399     // 3.2.4.3  Conversion from floating-point type.
    00400          decimal128(decimal32 d32);
    00401          decimal128(decimal64 d64);
    00402     explicit decimal128(float __r)      : __val(__r) {}
    00403     explicit decimal128(double __r)     : __val(__r) {}
    00404     explicit decimal128(long double __r)    : __val(__r) {}
    00405
    00406
    00407     // 3.2.4.4  Conversion from integral type.
    00408     decimal128(int __z)             : __val(__z) {}
    00409     decimal128(unsigned int __z)        : __val(__z) {}
    00410     decimal128(long __z)            : __val(__z) {}
    00411     decimal128(unsigned long __z)       : __val(__z) {}
    00412     decimal128(long long __z)           : __val(__z) {}
    00413     decimal128(unsigned long long __z)      : __val(__z) {}
    00414
    00415     /// Conforming extension: Conversion from scalar decimal type.
    00416     decimal128(__decfloat128 __z)       : __val(__z) {}
    00417
    00418     // 3.2.4.5  Conversion to integral type. (DISABLED)
    00419     //operator long long() const { return (long long)__val; }
    00420
    00421     // 3.2.4.6  Increment and decrement operators.
    00422     decimal128& operator++()
    00423     {
    00424       __val += 1;
    00425       return *this;
    00426     }
    00427
    00428     decimal128 operator++(int)
    00429     {
    00430       decimal128 __tmp = *this;
    00431       __val += 1;
    00432       return __tmp;
    00433     }
    00434
    00435     decimal128& operator--()
    00436     {
    00437       __val -= 1;
    00438       return *this;
    00439     }
    00440
    00441     decimal128   operator--(int)
    00442     {
    00443       decimal128 __tmp = *this;
    00444       __val -= 1;
    00445       return __tmp;
    00446     }
    00447
    00448     // 3.2.4.7  Compound assignment.
    00449 #define _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(_Op)    \
    00450     decimal128& operator _Op(decimal32 __rhs);      \
    00451     decimal128& operator _Op(decimal64 __rhs);      \
    00452     decimal128& operator _Op(decimal128 __rhs);     \
    00453     decimal128& operator _Op(int __rhs);        \
    00454     decimal128& operator _Op(unsigned int __rhs);   \
    00455     decimal128& operator _Op(long __rhs);       \
    00456     decimal128& operator _Op(unsigned long __rhs);  \
    00457     decimal128& operator _Op(long long __rhs);      \
    00458     decimal128& operator _Op(unsigned long long __rhs);
    00459
    00460     _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(+=)
    00461     _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(-=)
    00462     _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(*=)
    00463     _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT(/=)
    00464 #undef _DECLARE_DECIMAL128_COMPOUND_ASSIGNMENT
    00465
    00466   private:
    00467     __decfloat128 __val;
    00468
    00469   public:
    00470     __decfloat128 __getval(void) { return __val; }
    00471     void __setval(__decfloat128 __x) { __val = __x; }
    00472   };
    00473
    00474 #define _GLIBCXX_USE_DECIMAL_ 1
    00475
    00476 } // namespace decimal
    00477   // @} group decimal
    00478 } // namespace std
    00479
    00480 #include <decimal/decimal.h>
    00481
    00482 #endif /* _GLIBCXX_DECIMAL */