The Decimal data type in C++ represents a fixed-point decimal number. The isFinite function is a member function of the Decimal class that checks whether the given Decimal number is a finite value or not. A finite number is one which is neither infinite nor a "Not a Number" (NaN) value.
Example:
```c++
#include
#include
int main() {
Decimal num1("100.25");
Decimal num2(0.0 / 0.0); // NaN value
if (num1.isFinite()) {
std::cout << "num1 is a finite value" << std::endl;
}
if (num2.isFinite()) {
std::cout << "num2 is a finite value" << std::endl;
}
else {
std::cout << "num2 is not a finite value" << std::endl;
}
return 0;
}
```
In the above example, we create two Decimal objects - num1 with a finite value of 100.25 and num2 with a NaN value using division by zero. The isFinite() function is called for both of these objects and the output confirms that num1 is a finite value while num2 is not.
The Decimal library used in the above example is the libdecimal library which provides support for fixed-point decimal arithmetic in C++.
C++ (Cpp) Decimal::isFinite - 21 examples found. These are the top rated real world C++ (Cpp) examples of Decimal::isFinite extracted from open source projects. You can rate examples to help us improve the quality of examples.