xtd 0.2.0
box_floating_point.h
Go to the documentation of this file.
1 #pragma once
5 #include "box_integer.h"
6 #define __XTD_CORE_INTERNAL__
7 #include "internal/__box_floating_point.h"
8 #undef __XTD_CORE_INTERNAL__
9 
11 namespace xtd {
38  template<typename type_t>
39  class box_floating_point : public xtd::box_integer<type_t> {
40  public:
42  box_floating_point() = default;
44  box_floating_point(const box_floating_point&) = default;
46  box_floating_point& operator =(const box_floating_point&) = default;
48 
50 
54  static constexpr type_t epsilon = __get_epsilon(type_t{});
57  static constexpr type_t NaN = std::numeric_limits<type_t>::quiet_NaN();
60  static constexpr type_t negative_infinity = -std::numeric_limits<type_t>::infinity();
63  static constexpr type_t positive_infinity = +std::numeric_limits<type_t>::infinity();
65 
67 
72  static bool is_finite(type_t value) noexcept {return !is_infinity(value);}
76  static bool is_infinity(type_t value) noexcept {return is_negative_infinity(value) || is_positive_infinity(value);}
77 
81  static bool is_negative_infinity(type_t value) noexcept {return value <= negative_infinity;}
82 
86  static bool is_positive_infinity(type_t value) noexcept {return value >= positive_infinity;}
87 
91  static bool is_NaN(type_t value) noexcept {return value != value;}
93  };
94 }
static constexpr type_t NaN
Represents not a number (NaN). This field is constant.
Definition: box_floating_point.h:57
static constexpr type_t positive_infinity
Represents positive infinity. This field is constant.
Definition: box_floating_point.h:63
Represents a boxed floating point object.
Definition: box_floating_point.h:39
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
static bool is_finite(type_t value) noexcept
Determines whether the specified value is finite (zero, subnormal, or normal).
Definition: box_floating_point.h:72
const type_t & value() const noexcept
Gets the underlying value.
Definition: box.h:79
static constexpr type_t negative_infinity
Represents negative infinity. This field is constant.
Definition: box_floating_point.h:60
Represents a boxed integer object.
Definition: box_integer.h:36
static bool is_positive_infinity(type_t value) noexcept
Returns a value indicating whether the specified number evaluates to positive infinity.
Definition: box_floating_point.h:86
static bool is_NaN(type_t value) noexcept
Returns a value indicating whether the specified number evaluates to not a number.
Definition: box_floating_point.h:91
static bool is_infinity(type_t value) noexcept
Returns a value indicating whether the specified number evaluates to negative or positive infinity...
Definition: box_floating_point.h:76
static bool is_negative_infinity(type_t value) noexcept
Returns a value indicating whether the specified number evaluates to negative infinity.
Definition: box_floating_point.h:81
Contains xtd::box_integer class.
static constexpr type_t epsilon
Represents the smallest positive type_t value greater than zero. This field is constant.
Definition: box_floating_point.h:54