Skip to content

Commit 4a25581

Browse files
committed
Add doc comments as real examples
1 parent c4eab90 commit 4a25581

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

examples/basic_construction.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,25 @@ int main()
4040
std::cout << "Floats are not equal" << std::endl;
4141
}
4242

43+
// Demonstration of the overflow and underflow handling
44+
constexpr decimal64_t oveflow_value {100, 10000};
45+
if (isinf(oveflow_value))
46+
{
47+
std::cout << "Overflow constructs infinity" << std::endl;
48+
}
49+
50+
constexpr decimal64_t underflow_value {100, -10000};
51+
if (underflow_value == 0)
52+
{
53+
std::cout << "Underflow constructs zero" << std::endl;
54+
}
55+
56+
const decimal32_t non_finite_from_float {std::numeric_limits<double>::quiet_NaN()};
57+
if (isnan(non_finite_from_float))
58+
{
59+
std::cout << "NaN constructs NaN" << std::endl;
60+
}
61+
4362
return 0;
4463
}
4564

0 commit comments

Comments
 (0)