The decimal type of type C #, .NET System.Decimal is just a floating point number that is stored as base-10 instead of base-2 encoding. float and double are more typical base-2 floating-point numbers. That is, double is stored as +/- x * 2^y , while the decimal value is stored as +/- x * 10 ^ y . That is why it is better suited, for example, to financial data, which are usually expressed in terms of x * 10^-2 . The IEEE 754 standard (mathematical standard for floating point) calls this math with "decimal floating point" and defines a 32- and 64-bit version of each of them.
In C ++, these types are implemented in the std::decimal namespace and are called std::decimal::decimal32 and std::decimal::decimal64 in the <decimal> header. If Borland C ++ builder has this type, you will find it there. The GNU C ++ library includes this header, but AFAIK is not yet part of the standard, so BCB may not have it. In this case, you will need to use a third-party library. Intel @dash example The decimal floating point library is probably the best known library of this kind, although a Google search for IEEE 754 Decimal should appear different if for some reason you need them.
source share