xtd 0.2.0
Loading...
Searching...
No Matches
xtd::box_floating_point< type_t > Class Template Reference
Inheritance diagram for xtd::box_floating_point< type_t >:
xtd::box_integer< type_t > xtd::box< type_t > xtd::object xtd::icomparable< box< type_t > > xtd::iequatable< box< type_t > > xtd::iformatable xtd::interface xtd::comparison_operators< type_t, comparable_t > xtd::interface xtd::equality_operators< type_t, equatable_t > xtd::interface

Definition

template<typename type_t>
class xtd::box_floating_point< type_t >

Represents a boxed floating point object.

class box_floating_point : public xtd::box<type_t>
Represents a boxed floating point object.
Definition box_floating_point.h:41
Represents a boxed object.
Definition box.h:53
Inheritance
xtd::objectxtd::box <type_t> → xtd::box_integer <type_t> → box_floating_point <type_t>
Header
#include <xtd/box°floating_point>
Namespace
xtd
Library
xtd.core
Remarks
You can use xtd::box to represent a class or structure that does not inherit from xtd::object. Typically used for integral types.
Use xtd::boxing to box an object.
Use xtd::unboxing to unbox an object.
For more information about types, see Native types, boxing and unboxing.
Examples
The following example shows how to create and use xtd::box_floating_point<float>.
auto stringer = [](const object& value) {return value.to_string();};
float unboxed_object = 3.14f;
box_floating_point<float> boxed_object = unboxed_object;
auto result = stringer(boxed_object);
console::write_line("result = {}", result); // Display: result = 3.14;
const type_t & value() const noexcept
Gets the underlying value.
Definition box.h:85
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...

Public Fields

static constexpr type_t epsilon
 Represents the smallest positive type_t value greater than zero. This field is constant.
 
static constexpr type_t NaN
 Represents not a number (NaN). This field is constant.
 
static constexpr type_t negative_infinity
 Represents negative infinity. This field is constant.
 
static constexpr type_t positive_infinity
 Represents positive infinity. This field is constant.
 

Public Static Methods

static bool is_finite (type_t value) noexcept
 Determines whether the specified value is finite (zero, subnormal, or normal).
 
static bool is_infinity (type_t value) noexcept
 Returns a value indicating whether the specified number evaluates to negative or positive infinity.
 
static bool is_negative_infinity (type_t value) noexcept
 Returns a value indicating whether the specified number evaluates to negative infinity.
 
static bool is_positive_infinity (type_t value) noexcept
 Returns a value indicating whether the specified number evaluates to positive infinity.
 
static bool is_NaN (type_t value) noexcept
 Returns a value indicating whether the specified number evaluates to not a number.
 

Additional Inherited Members

- Public Types inherited from xtd::box< type_t >
using underlying_type = type_t
 
- Static Public Attributes inherited from xtd::box_integer< type_t >
static constexpr type_t max_value
 Represents the largest possible value of type_t. This field is constant.
 
static constexpr type_t min_value
 Represents the smallest possible value of type_t. This field is constant.
 
- Public Member Functions inherited from xtd::box< type_t >
 box ()=default
 Initialize a new xtd::box object.
 
 box (const type_t &value)
 Initialize a new xtd::box object with specified value.
 
template<typename ... args_t>
 box (args_t &&...args)
 Initialize a new xtd::box object with specified value.
 
const type_t & value () const noexcept
 Gets the underlying value.
 
type_t & value () noexcept
 Gets the underlying value.
 
boxvalue (const type_t &value)
 Sets de underlying value.
 
 operator type_t () const noexcept
 
int32 compare_to (const box &value) const noexcept override
 Compares the current instance with another object of the same type.
 
bool equals (const object &obj) const noexcept override
 Determines whether the specified object is equal to the current object.
 
bool equals (const box &value) const noexcept override
 Indicates whether the current object is equal to another object of the same type.
 
xtd::string to_string () const noexcept override
 Returns a xtd::string that represents the current object.
 
xtd::string to_string (const xtd::string &format) const
 Converts the value of this instance to its equivalent string representation, using the specified format.
 
xtd::string to_string (const xtd::string &format, const std::locale &loc) const override
 Converts the value of this instance to its equivalent string representation, using the specified format, and locale.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance.
 
template<typename object_t >
xtd::uptr< object_t > memberwise_clone () const
 Creates a shallow copy of the current object.
 
- Public Member Functions inherited from xtd::icomparable< box< type_t > >
- Public Member Functions inherited from xtd::iequatable< box< type_t > >
- Public Member Functions inherited from xtd::iformatable
- Static Public Member Functions inherited from xtd::box_integer< type_t >
static type_t parse (const xtd::string &value, xtd::number_styles styles)
 Converts the string to its type_t equivalent.
 
static bool parse (const xtd::string &value, type_t &result, xtd::number_styles styles)
 Converts the string to its type_t equivalent.
 
- Static Public Member Functions inherited from xtd::box< type_t >
static type_t parse (const xtd::string &value)
 Converts the string to its type_t equivalent.
 
static bool try_parse (const xtd::string &value, type_t &result) noexcept
 Converts the string to its type_t equivalent. A return value indicates whether the conversion succeeded or failed.
 
- Static Public Member Functions inherited from xtd::object
template<typename object_a_t , typename object_b_t >
static bool equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
template<typename object_a_t , typename object_b_t >
static bool reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 

Member Function Documentation

◆ is_finite()

template<typename type_t >
static bool xtd::box_floating_point< type_t >::is_finite ( type_t  value)
inlinestaticnoexcept

Determines whether the specified value is finite (zero, subnormal, or normal).

Parameters
valueA floating-point number.
Returns
true if the value is finite (zero, subnormal or normal); false otherwise.

◆ is_infinity()

template<typename type_t >
static bool xtd::box_floating_point< type_t >::is_infinity ( type_t  value)
inlinestaticnoexcept

Returns a value indicating whether the specified number evaluates to negative or positive infinity.

Parameters
valueA floating-point number.
Returns
true if value evaluates to xtd::math::positive_infinity or xtd::math::negative_infinity; otherwise, false.

◆ is_negative_infinity()

template<typename type_t >
static bool xtd::box_floating_point< type_t >::is_negative_infinity ( type_t  value)
inlinestaticnoexcept

Returns a value indicating whether the specified number evaluates to negative infinity.

Parameters
valueA floating-point number.
Returns
true if value evaluates to xtd::math::negative_infinity; otherwise, false.

◆ is_positive_infinity()

template<typename type_t >
static bool xtd::box_floating_point< type_t >::is_positive_infinity ( type_t  value)
inlinestaticnoexcept

Returns a value indicating whether the specified number evaluates to positive infinity.

Parameters
valueA floating-point number.
Returns
true if value evaluates to xtd::math::positive_infinity; otherwise, false.

◆ is_NaN()

template<typename type_t >
static bool xtd::box_floating_point< type_t >::is_NaN ( type_t  value)
inlinestaticnoexcept

Returns a value indicating whether the specified number evaluates to not a number.

Parameters
valueA floating-point number.
Returns
true if value evaluates to not a number; otherwise, false.

Member Data Documentation

◆ epsilon

template<typename type_t >
constexpr type_t xtd::box_floating_point< type_t >::epsilon
staticconstexpr

Represents the smallest positive type_t value greater than zero. This field is constant.

Remarks
The value of this field is 4.94066e-324.

◆ NaN

template<typename type_t >
constexpr type_t xtd::box_floating_point< type_t >::NaN
staticconstexpr

Represents not a number (NaN). This field is constant.

Remarks
The value of this field is std::numeric_limits<type_t>::quiet_NaN().

◆ negative_infinity

template<typename type_t >
constexpr type_t xtd::box_floating_point< type_t >::negative_infinity
staticconstexpr

Represents negative infinity. This field is constant.

Remarks
The value of this field is -std::numeric_limits<type_t>::infinity().

◆ positive_infinity

template<typename type_t >
constexpr type_t xtd::box_floating_point< type_t >::positive_infinity
staticconstexpr

Represents positive infinity. This field is constant.

Remarks
The value of this field is std::numeric_limits<type_t>::infinity().

The documentation for this class was generated from the following file: