| 1460 | |
| 1461 | template <unsigned Digits10, class ExponentType, class Allocator> |
| 1462 | bool cpp_dec_float<Digits10, ExponentType, Allocator>::isone() const |
| 1463 | { |
| 1464 | // Check if the value of *this is identically 1 or very close to 1. |
| 1465 | |
| 1466 | const bool not_negative_and_is_finite = ((!neg) && (isfinite)()); |
| 1467 | |
| 1468 | if (not_negative_and_is_finite) |
| 1469 | { |
| 1470 | if ((data[0u] == static_cast<std::uint32_t>(1u)) && (exp == static_cast<exponent_type>(0))) |
| 1471 | { |
| 1472 | const typename array_type::const_iterator it_non_zero = std::find_if(data.begin(), data.end(), data_elem_is_non_zero_predicate); |
| 1473 | return (it_non_zero == data.end()); |
| 1474 | } |
| 1475 | else if ((data[0u] == static_cast<std::uint32_t>(cpp_dec_float_elem_mask - 1)) && (exp == static_cast<exponent_type>(-cpp_dec_float_elem_digits10))) |
| 1476 | { |
| 1477 | const typename array_type::const_iterator it_non_nine = std::find_if(data.begin(), data.end(), data_elem_is_non_nine_predicate); |
| 1478 | return (it_non_nine == data.end()); |
| 1479 | } |
| 1480 | } |
| 1481 | |
| 1482 | return false; |
| 1483 | } |
| 1484 | |
| 1485 | template <unsigned Digits10, class ExponentType, class Allocator> |
| 1486 | bool cpp_dec_float<Digits10, ExponentType, Allocator>::isint() const |