xtd 1.0.0
Loading...
Searching...
No Matches
xtd::math Class Reference
Inheritance diagram for xtd::math:
xtd::static_object

Definition

Provides constants and static methods for trigonometric, logarithmic, and other common mathematical functions.

Namespace
xtd
Library
xtd.core
Remarks
This class cannot be inherited.
Examples
The following example uses several mathematical and trigonometric functions from the xtd::math class to calculate the inner angles of a trapezoid.
#include <xtd/xtd>
namespace math_example {
// The following class represents simple functionality of the trapezoid.
class math_trapezoid_sample {
public:
// The main entry point for the application.
static auto main() {
auto trpz = math_trapezoid_sample {20.0, 10.0, 8.0, 6.0};
console::write_line("The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0");
auto h = trpz.get_height();
console::write_line("trapezoid height is: {0}", h);
auto dx_r = trpz.get_left_base_radian_angle();
console::write_line("trapezoid left base angle is: {0} Radians", dx_r);
auto dy_r = trpz.get_right_base_radian_angle();
console::write_line("trapezoid right base angle is: {0} Radians", dy_r);
auto dx_d = trpz.get_left_base_degree_angle();
console::write_line("trapezoid left base angle is: {0} Degrees", dx_d);
auto dy_d = trpz.get_right_base_degree_angle();
console::write_line("trapezoid left base angle is: {0} Degrees", dy_d);
}
math_trapezoid_sample(double long_base, double short_base, double left_leg, double right_leg) {
long_base_ = math::abs(long_base);
short_base_ = math::abs(short_base);
left_leg_ = math::abs(left_leg);
right_leg_ = math::abs(right_leg);
}
auto get_height()->double {
auto x = get_right_small_base();
return math::sqrt(math::pow(right_leg_, 2.0) - math::pow(x, 2.0));
}
auto get_square()->double {
return get_height() * long_base_ / 2.0;
}
auto get_left_base_radian_angle()->double {
auto sin_x = get_height() / left_leg_;
return math::round(math::asin(sin_x), 2);
}
auto get_right_base_radian_angle()->double {
auto x = get_right_small_base();
auto cos_x = (math::pow(right_leg_, 2.0) + math::pow(x, 2.0) - math::pow(get_height(), 2.0)) / (2 * x * right_leg_);
return math::round(math::acos(cos_x), 2);
}
auto get_left_base_degree_angle()->double {
auto x = math::radians_to_degrees(get_left_base_radian_angle());
return math::round(x, 2);
}
auto get_right_base_degree_angle()->double {
auto x = math::radians_to_degrees(get_right_base_radian_angle());
return math::round(x, 2);
}
private:
auto get_right_small_base()->double {
return (math::pow(right_leg_, 2.0) - math::pow(left_leg_, 2.0) + math::pow(long_base_, 2.0) + math::pow(short_base_, 2.0) - 2 * short_base_ * long_base_) / (2 * (long_base_ - short_base_));
}
double long_base_ = .0;
double short_base_ = .0;
double left_leg_ = .0;
double right_leg_ = .0;
};
}
startup_(math_example::math_trapezoid_sample::main);
// This code produces the following output :
//
// The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0
// trapezoid height is: 4.8
// trapezoid left base angle is: 0.64 Radians
// trapezoid right base angle is: 0.93 Radians
// trapezoid left base angle is: 36.67 Degrees
// trapezoid left base angle is: 53.29 Degrees
static auto write_line() -> void
Writes the current line terminator to the standard output stream using the specified format informati...
#define startup_(...)
Defines the entry point to be called when the application loads. Generally this is set either to the ...
Definition startup.hpp:284
@ h
The H key.
Definition console_key.hpp:102
@ x
The X key.
Definition console_key.hpp:134

Public Fields

static constexpr double e
 Represents the natural logarithmic base, specified by the constant, e. This field is constant.
static constexpr double pi
 Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. This field is constant.
static constexpr double tau
 Represents the number of radians in one turn, specified by the constant, τ.

Public Deprecated Fields

static constexpr auto epsilon
 Represents the smallest positive Double value greater than zero. This field is constant.
static constexpr auto infinity
 Represents infinity. This field is constant.
static constexpr auto max_value
 Represents the largest possible value of double. This field is constant.
static constexpr auto min_value
 Represents the smallest possible value of double. This field is constant.
static constexpr auto NaN
 Represents not a number (NaN). This field is constant.
static constexpr auto negative_infinity
 Represents negative infinity. This field is constant.
static constexpr auto positive_infinity
 Represents positive infinity. This field is constant.

Public Static Methods

static auto abs (xtd::decimal value) -> xtd::decimal
 Returns the absolute value of a decimal number.
static auto abs (double value) -> double
 Returns the absolute value of a double-precision floating-point number.
static auto abs (xtd::single value) -> xtd::single
 Returns the absolute value of a single-precision floating-point number.
static auto abs (xtd::int16 value) -> xtd::int16
 Returns the absolute value of a 16-bit signed integer.
static auto abs (xtd::int32 value) -> xtd::int32
 Returns the absolute value of a 32-bit signed integer.
static auto abs (xtd::int64 value) -> xtd::int64
 Returns the absolute value of a 64-bit signed integer.
static auto abs (xtd::sbyte value) -> xtd::sbyte
 Returns the absolute value of a 8-bit signed integer.
static auto abs (xtd::slong value) -> xtd::slong
 Returns the absolute value of a 64-bit signed integer.
static auto acos (double value) -> double
 Returns the angle whose cosine is the specified number.
static auto asin (double value) -> double
 Returns the angle whose sine is the specified number.
static auto atan (double value) -> double
 Returns the angle whose tangent is the specified number.
static auto atan2 (double y, double x) -> double
 Returns the angle whose tangent is the specified number.
static auto big_mul (xtd::int32 a, xtd::int32 b) -> xtd::int64
 Produces the full product of two 32-bit numbers.
static auto ceiling (xtd::decimal value) -> xtd::decimal
 Returns the smallest integer greater than or equal to the specified double-precision floating-point number.
static double ceiling (double value)
 Returns the smallest integer greater than or equal to the specified double-precision floating-point number.
static auto clamp (xtd::byte value, xtd::byte min, xtd::byte max) noexcept -> xtd::byte
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::decimal value, xtd::decimal min, xtd::decimal max) noexcept -> xtd::decimal
 Returns value clamped to the inclusive range of min and max.
static auto clamp (double value, double min, double max) noexcept -> double
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::int16 value, xtd::int16 min, xtd::int16 max) noexcept -> xtd::int16
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::int32 value, xtd::int32 min, xtd::int32 max) noexcept -> xtd::int32
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::int64 value, xtd::int64 min, xtd::int64 max) noexcept -> xtd::int64
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::slong value, xtd::slong min, xtd::slong max) noexcept -> xtd::slong
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::sbyte value, xtd::sbyte min, xtd::sbyte max) noexcept -> xtd::sbyte
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::single value, xtd::single min, xtd::single max) noexcept -> xtd::single
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::uint16 value, xtd::uint16 min, xtd::uint16 max) noexcept -> xtd::uint16
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::uint32 value, xtd::uint32 min, xtd::uint32 max) noexcept -> xtd::uint32
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::uint64 value, xtd::uint64 min, xtd::uint64 max) noexcept -> xtd::uint64
 Returns value clamped to the inclusive range of min and max.
static auto clamp (xtd::ulong value, xtd::ulong min, xtd::ulong max) noexcept -> xtd::ulong
 Returns value clamped to the inclusive range of min and max.
static auto cos (double value) -> double
 Returns the cosine of the specified angle.
static auto cosh (double value) -> double
 Returns the hyperbolic cosine of the specified angle.
static auto degrees_to_radians (double degrees) noexcept -> double
 Convert degrees to radians.
static auto div_rem (xtd::int32 dividend, xtd::int32 divisor, xtd::int32 &remainder) -> xtd::int32
 Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter.
static auto div_rem (xtd::int64 dividend, xtd::int64 divisor, xtd::int64 &remainder) -> xtd::int64
 Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.
static auto exp (double value) -> double
 Returns e raised to the specified power.
static auto floor (xtd::decimal value) -> xtd::decimal
 Returns the largest integer less than or equal to the specified decimal number.
static auto floor (double value) -> double
 Returns the largest integer less than or equal to the specified decimal number.
static auto ieee_remainder (double dividend, double divisor) -> double
 Returns the remainder resulting from the division of a specified number by another specified number.
static auto log (double value) -> double
 Returns the natural (base e) logarithm of a specified number.
static auto log (double a, double new_base) -> double
 Returns the logarithm of a specified number in a specified base.
static auto log10 (double value) -> double
 Returns the base 10 logarithm of a specified number.
static auto max (xtd::byte a, xtd::byte b) noexcept -> xtd::byte
 Returns the larger of two 8-bit unsigned integers.
static auto max (xtd::decimal a, xtd::decimal b) noexcept -> xtd::decimal
 Returns the larger of two double single.
static auto max (double a, double b) noexcept -> double
 Returns the larger of two double single.
static auto max (xtd::int16 a, xtd::int16 b) noexcept -> xtd::int16
 Returns the larger of two 16-bit signed integers.
static auto max (xtd::int32 a, xtd::int32 b) noexcept -> xtd::int32
 Returns the larger of two 32-bit signed integers.
static auto max (xtd::int64 a, xtd::int64 b) noexcept -> xtd::int64
 Returns the larger of two 64-bit signed integers.
static auto max (xtd::slong a, xtd::slong b) noexcept -> xtd::slong
 Returns the larger of two 64-bit signed integers.
static auto max (xtd::sbyte a, xtd::sbyte b) noexcept -> xtd::sbyte
 Returns the larger of two 8-bit signed integers.
static auto max (xtd::single a, xtd::single b) noexcept -> xtd::single
 Returns the larger of two single single.
static auto max (xtd::uint16 a, xtd::uint16 b) noexcept -> xtd::uint16
 Returns the larger of two 16-bit unsigned integers.
static auto max (xtd::uint32 a, xtd::uint32 b) noexcept -> xtd::uint32
 Returns the larger of two 32-bit unsigned integers.
static auto max (xtd::uint64 a, xtd::uint64 b) noexcept -> xtd::uint64
 Returns the larger of two 64-bit unsigned integers.
static auto max (xtd::ulong a, xtd::ulong b) noexcept -> xtd::ulong
 Returns the larger of two 64-bit unsigned integers.
static auto min (xtd::byte a, xtd::byte b) noexcept -> xtd::byte
 Returns the smaller of two 8-bit unsigned integers.
static auto min (xtd::decimal a, xtd::decimal b) noexcept -> xtd::decimal
 Returns the smaller of two double single.
static auto min (double a, double b) noexcept -> double
 Returns the smaller of two double single.
static auto min (xtd::int16 a, xtd::int16 b) noexcept -> xtd::int16
 Returns the smaller of two 16-bit signed integers.
static auto min (xtd::int32 a, xtd::int32 b) noexcept -> xtd::int32
 Returns the smaller of two 32-bit signed integers.
static auto min (xtd::int64 a, xtd::int64 b) noexcept -> xtd::int64
 Returns the smaller of two 64-bit signed integers.
static auto min (xtd::slong a, xtd::slong b) noexcept -> xtd::slong
 Returns the smaller of two 64-bit signed integers.
static auto min (xtd::sbyte a, xtd::sbyte b) noexcept -> xtd::sbyte
 Returns the smaller of two 8-bit signed integers.
static auto min (xtd::single a, xtd::single b) noexcept -> xtd::single
 Returns the smaller of two single single.
static auto min (xtd::uint16 a, xtd::uint16 b) noexcept -> xtd::uint16
 Returns the smaller of two 16-bit unsigned integers.
static auto min (xtd::uint32 a, xtd::uint32 b) noexcept -> xtd::uint32
 Returns the smaller of two 32-bit unsigned integers.
static auto min (xtd::uint64 a, xtd::uint64 b) noexcept -> xtd::uint64
 Returns the smaller of two 64-bit unsigned integers.
static auto min (xtd::ulong a, xtd::ulong b) noexcept -> xtd::ulong
 Returns the smaller of two 64-bit unsigned integers.
static auto pow (double x, double y) -> double
 Returns a specified number raised to the specified power.
static auto radians_to_degrees (double radians) noexcept -> double
 Convert radians to degrees.
static auto round (xtd::decimal value) -> xtd::decimal
 Rounds a double-precision floating-point value to the nearest integral value.
static auto round (xtd::decimal value, xtd::int32 decimals) -> xtd::decimal
 Rounds a xtd::decimal value to a specified number of fractional digits.
static auto round (double value) -> double
 Rounds a double-precision floating-point value to the nearest integral value.
static auto round (double value, xtd::int32 decimals) -> double
 Rounds a xtd::decimal value to a specified number of fractional digits.
static auto sign (xtd::decimal value) -> xtd::int32
 Returns a value indicating the sign of a double-precision floating-point number.
static auto sign (double value) -> xtd::int32
 Returns a value indicating the sign of a double-precision floating-point number.
static auto sign (xtd::int16 value) -> xtd::int32
 Returns a value indicating the sign of a 16-bit signed integer.
static auto sign (xtd::int32 value) -> xtd::int32
 Returns a value indicating the sign of a 32-bit signed integer.
static auto sign (xtd::int64 value) -> xtd::int32
 Returns a value indicating the sign of a 64-bit signed integer.
static auto sign (xtd::slong value) -> xtd::int32
 Returns a value indicating the sign of a 64-bit signed integer.
static auto sign (xtd::sbyte value) -> xtd::int32
 Returns a value indicating the sign of an 8-bit signed integer.
static auto sign (xtd::single value) -> xtd::int32
 Returns a value indicating the sign of a single-precision floating-point number.
static auto sin (double value) -> double
 Returns the sine of the specified angle.
static auto sinh (double value) -> double
 Returns the hyperbolic sine of the specified angle.
static auto sqrt (double value) -> double
 Returns the square root of a specified number.
static auto tan (double value) -> double
 Returns the tangent of the specified angle.
static auto tanh (double value) -> double
 Returns the hyperbolic tangent of the specified angle.
static auto truncate (xtd::decimal value) -> xtd::decimal
 Calculates the integral part of a specified double-precision floating-point number.
static auto truncate (double value) -> double
 Calculates the integral part of a specified double-precision floating-point number.

Public Deprecated Static Methods

static auto is_infinity (double value) noexcept -> bool
 Returns a value indicating whether the specified number evaluates to negative or positive infinity.
static auto is_negative_infinity (double value) noexcept -> bool
 Returns a value indicating whether the specified number evaluates to negative infinity.
static auto is_positive_infinity (double value) noexcept -> bool
 Returns a value indicating whether the specified number evaluates to positive infinity.
static auto is_NaN (double value) noexcept -> bool
 Returns a value indicating whether the specified number evaluates to not a number.

Member Function Documentation

◆ abs() [1/8]

auto xtd::math::abs ( xtd::decimal value) -> xtd::decimal
staticnodiscard

Returns the absolute value of a decimal number.

Parameters
valueA number in the range xtd::decimal_object::min_value <= value <= xtd::decimal_object::max_value.
Returns
A decimal number, x, such that 0 <= x <= xtd::decimal_object::max_value.
Examples
image_effects.cpp.

◆ abs() [2/8]

auto xtd::math::abs ( double value) -> double
staticnodiscard

Returns the absolute value of a double-precision floating-point number.

Parameters
valueA number in the range xtd::double_object::min_value <= value <= xtd::double_object::max_value.
Returns
A double-precision floating-point number, x, such that 0 <= x <= stdxtd::double_object::max_value.

◆ abs() [3/8]

auto xtd::math::abs ( xtd::single value) -> xtd::single
staticnodiscard

Returns the absolute value of a single-precision floating-point number.

Parameters
valueA number in the range xtd::single_object::min_value <= value <= xtd::single_object::max_value.
Returns
A single-precision floating-point number, x, such that 0 <= x <= xtd::single_object::max_value.

◆ abs() [4/8]

auto xtd::math::abs ( xtd::int16 value) -> xtd::int16
staticnodiscard

Returns the absolute value of a 16-bit signed integer.

Parameters
valueA number in the range xtd::int16_object::min_value <= value <= xtd::int16_object::max_value.
Returns
A 16-bit signed integer, x, such that 0 <= x <= xtd::int16_object::max_value.
Exceptions
xtd::overflow_exceptionvalue equals xtd::int16_object::min_value.

◆ abs() [5/8]

auto xtd::math::abs ( xtd::int32 value) -> xtd::int32
staticnodiscard

Returns the absolute value of a 32-bit signed integer.

Parameters
valueA number in the range xtd::int32_object::min_value <= value <= xtd::int32_object::max_value.
Returns
A 32-bit signed integer, x, such that 0 <= x <= xtd::int32_object::max_value.
Exceptions
xtd::overflow_exceptionvalue equals xtd::int32_object::min_value.

◆ abs() [6/8]

auto xtd::math::abs ( xtd::int64 value) -> xtd::int64
staticnodiscard

Returns the absolute value of a 64-bit signed integer.

Parameters
valueA number in the range xtd::int64_object::min_value <= value <= xtd::int64_object::max_value.
Returns
A 64-bit signed integer, x, such that 0 <= x <= xtd::int64_object::max_value.
Exceptions
xtd::overflow_exceptionvalue equals xtd::int64_object::min_value.

◆ abs() [7/8]

auto xtd::math::abs ( xtd::sbyte value) -> xtd::sbyte
staticnodiscard

Returns the absolute value of a 8-bit signed integer.

Parameters
valueA number in the range xtd::sbyte_object::min_value <= value <= xtd::sbyte_object::max_value.
Returns
A 8-bit signed integer, x, such that 0 <= x <= xtd::sbyte_object::max_value.
Exceptions
xtd::overflow_exceptionvalue equals xtd::sbyte_object::min_value.

◆ abs() [8/8]

auto xtd::math::abs ( xtd::slong value) -> xtd::slong
staticnodiscard

Returns the absolute value of a 64-bit signed integer.

Parameters
valueA number in the range xtd::slong_object::min_value <= value <= xtd::slong_object::max_value.
Returns
A 8-bit signed integer, x, such that 0 <= x <= xtd::slong_object::max_value.
Exceptions
xtd::overflow_exceptionvalue equals xtd::slong_object::min_value.

◆ acos()

auto xtd::math::acos ( double value) -> double
staticnodiscard

Returns the angle whose cosine is the specified number.

Parameters
valueA number representing a cosine, where -1 <= value <= 1.
Returns
An angle, A, measured in radians, such that 0 <= A <= PI.
-or-
math::NaN if value < -1 or d > 1.

◆ asin()

auto xtd::math::asin ( double value) -> double
staticnodiscard

Returns the angle whose sine is the specified number.

Parameters
valueA number representing a sine, where -1 <= value <= 1.
Returns
An angle, A, measured in radians, such that -PI/2 <= A <= PI/2.
-or-
math::NaN if value < -1 or d > 1.

◆ atan()

auto xtd::math::atan ( double value) -> double
staticnodiscard

Returns the angle whose tangent is the specified number.

Parameters
valueA number representing a tangent.
Returns
An angle, A, measured in radians, such that -PI/2 <= ? <= PI/2.
-or-
math::NaN if value equals math::NaN, -PI/2 rounded to double precision (-1.5707963267949) if d equals math::negative_infinity, or PI/2 rounded to double precision (1.5707963267949) if d equals math::positive_infinity

◆ atan2()

auto xtd::math::atan2 ( double y,
double x ) -> double
staticnodiscard

Returns the angle whose tangent is the specified number.

Parameters
yThe y coordinate of a point.
xThe x coordinate of a point.
Returns
An angle, A, measured in radians, such that -PI <= A <= PI, and tan(?) = y / x, where (x, y) is a point in the Cartesian plane.

Observe the following:

  • For (x, y) in quadrant 1, 0 < A < PI/2.
  • For (x, y) in quadrant 2, PI/2 < A <= PI.
  • For (x, y) in quadrant 3, -PI < A < -PI/2.
  • For (x, y) in quadrant 4, -PI/2 < A < 0.
  • For points on the boundaries of the quadrants, the return value is the following:
  • If x is 0 and y is not negative, A = 0.
  • If x is 0 and y is negative, A = PI.
  • If x is positive and y is 0, A = PI/2.
  • If x is negative and y is 0, A = -PI/2.
    Remarks
    The return value is the angle in the Cartesian plane formed by the x-axis, and a vector starting from the origin, (0,0), and terminating at the point, (x,y).

◆ big_mul()

auto xtd::math::big_mul ( xtd::int32 a,
xtd::int32 b ) -> xtd::int64
staticnodiscard

Produces the full product of two 32-bit numbers.

Parameters
aThe first xtd::int32 to multiply.
bThe second xtd::int32 to multiply.
Returns
The xtd::int64 containing the product of the specified numbers.

◆ ceiling() [1/2]

auto xtd::math::ceiling ( xtd::decimal value) -> xtd::decimal
staticnodiscard

Returns the smallest integer greater than or equal to the specified double-precision floating-point number.

Parameters
valueA double-precision floating-point number.
Returns
The smallest integer greater than or equal to value. If value is equal to xtd::math::NaN, xtd::math::negative_infinity, or xtd::math::positive_infinity, that value is returned.

◆ ceiling() [2/2]

double xtd::math::ceiling ( double value)
staticnodiscard

Returns the smallest integer greater than or equal to the specified double-precision floating-point number.

Parameters
valueA double-precision floating-point number.
Returns
The smallest integer greater than or equal to value. If value is equal to xtd::math::NaN, xtd::math::negative_infinity, or xtd::math::positive_infinity, that value is returned.

◆ clamp() [1/13]

auto xtd::math::clamp ( xtd::byte value,
xtd::byte min,
xtd::byte max ) -> xtd::byte
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [2/13]

auto xtd::math::clamp ( xtd::decimal value,
xtd::decimal min,
xtd::decimal max ) -> xtd::decimal
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [3/13]

auto xtd::math::clamp ( double value,
double min,
double max ) -> double
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [4/13]

auto xtd::math::clamp ( xtd::int16 value,
xtd::int16 min,
xtd::int16 max ) -> xtd::int16
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [5/13]

auto xtd::math::clamp ( xtd::int32 value,
xtd::int32 min,
xtd::int32 max ) -> xtd::int32
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [6/13]

auto xtd::math::clamp ( xtd::int64 value,
xtd::int64 min,
xtd::int64 max ) -> xtd::int64
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [7/13]

auto xtd::math::clamp ( xtd::slong value,
xtd::slong min,
xtd::slong max ) -> xtd::slong
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [8/13]

auto xtd::math::clamp ( xtd::sbyte value,
xtd::sbyte min,
xtd::sbyte max ) -> xtd::sbyte
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [9/13]

auto xtd::math::clamp ( xtd::single value,
xtd::single min,
xtd::single max ) -> xtd::single
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [10/13]

auto xtd::math::clamp ( xtd::uint16 value,
xtd::uint16 min,
xtd::uint16 max ) -> xtd::uint16
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [11/13]

auto xtd::math::clamp ( xtd::uint32 value,
xtd::uint32 min,
xtd::uint32 max ) -> xtd::uint32
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [12/13]

auto xtd::math::clamp ( xtd::uint64 value,
xtd::uint64 min,
xtd::uint64 max ) -> xtd::uint64
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ clamp() [13/13]

auto xtd::math::clamp ( xtd::ulong value,
xtd::ulong min,
xtd::ulong max ) -> xtd::ulong
staticnodiscardnoexcept

Returns value clamped to the inclusive range of min and max.

Parameters
valueThe value to be clamped.
minThe lower bound of the result.
maxThe upper bound of the result.
Returns
value if min <= value <= max.
-or-
min if value < min.
>-or-
max if max < value.

◆ cos()

auto xtd::math::cos ( double value) -> double
staticnodiscard

Returns the cosine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The cosine of value. If value is equal to xtd::math::NaN, xtd::math::negative_infinity, or xtd::math::positive_infinity, this method returns xtd::math::NaN.

◆ cosh()

auto xtd::math::cosh ( double value) -> double
staticnodiscard

Returns the hyperbolic cosine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The hyperbolic cosine of value. If value is equal to xtd::math::negative_infinity() or xtd::math::positive_:infinity, xtd::math::positive_infinity is returned. If value is equal to xtd::math::NaN, xtd::math::NaN is returned.

◆ degrees_to_radians()

auto xtd::math::degrees_to_radians ( double degrees) -> double
staticnodiscardnoexcept

Convert degrees to radians.

Parameters
degreesA double-precision floating-point number.
Returns
A converted degrees from radians.

◆ div_rem() [1/2]

auto xtd::math::div_rem ( xtd::int32 dividend,
xtd::int32 divisor,
xtd::int32 & remainder ) -> xtd::int32
staticnodiscard

Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output parameter.

Parameters
dividendThe dividend.
divisorThe divisor.
remainderAn angle, measured in radians.
Returns
The remainder.

◆ div_rem() [2/2]

auto xtd::math::div_rem ( xtd::int64 dividend,
xtd::int64 divisor,
xtd::int64 & remainder ) -> xtd::int64
staticnodiscard

Calculates the quotient of two 64-bit signed integers and also returns the remainder in an output parameter.

Parameters
dividendThe dividend.
divisorThe divisor.
remainderAn angle, measured in radians.
Returns
The remainder.

◆ exp()

auto xtd::math::exp ( double value) -> double
staticnodiscard

Returns e raised to the specified power.

Parameters
valueA number specifying a power.
Returns
The number e raised to the power d. If value equals xtd::math::NaN or xtd::math::positive_infinity, that value is returned. If value equals xtd::math::negative_infinity, 0 is returned.

◆ floor() [1/2]

auto xtd::math::floor ( xtd::decimal value) -> xtd::decimal
staticnodiscard

Returns the largest integer less than or equal to the specified decimal number.

Parameters
valueA double-precision floating-point number.
Returns
The largest integer less than or equal to value.

◆ floor() [2/2]

auto xtd::math::floor ( double value) -> double
staticnodiscard

Returns the largest integer less than or equal to the specified decimal number.

Parameters
valueA double-precision floating-point number.
Returns
The largest integer less than or equal to value.

◆ ieee_remainder()

auto xtd::math::ieee_remainder ( double dividend,
double divisor ) -> double
staticnodiscard

Returns the remainder resulting from the division of a specified number by another specified number.

Parameters
dividendA dividend.
divisorA divisor.
Returns
A number equal to x - (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is returned).
  • If x - (y Q) is zero, the value +0 is returned if x is positive, or -0 if x is negative.
  • If y = 0, xtd::math::NaN is returned.

◆ log() [1/2]

auto xtd::math::log ( double value) -> double
staticnodiscard

Returns the natural (base e) logarithm of a specified number.

Parameters
valueA number whose logarithm is to be found.
Returns
One of the values in the following table.
value parameter Return value
Positive The natural logarithm of d; that is, ln value, or log e value
Zero xtd::math::negative_infinity
Negative xtd::math::NaN
Equal to xtd::math::NaN xtd::math::NaN
Equal to xtd::math::positive_infinity xtd::math::positive_infinity
Remarks
Parameter value is specified as a base 10 number.

◆ log() [2/2]

auto xtd::math::log ( double a,
double new_base ) -> double
staticnodiscard

Returns the logarithm of a specified number in a specified base.

Parameters
aThe number whose logarithm is to be found.
new_baseThe base of the logarithm.
Returns
One of the values in the following table. (+Infinity denotes math::positive_infinity, -Infinity denotes math::negative_infinity, and math::NaN denotes math::NaN.)
a new_base Return value
a > 0 (0 < new_base < 1)
-or-
(new_base > 1)
log new_base (a)
a < 0 (any value) xtd::math::NaN
(any value) new_base < 0 xtd::math::NaN
a != 1 new_base = 0 xtd::math::NaN
a != 1 new_base = xtd::math::positive_infinity xtd::math::NaN
a = xtd::math::NaN (any value) xtd::math::NaN
(any value) new_base = xtd::math::NaN xtd::math::NaN
(any value) new_base = 1 xtd::math::NaN
a = 0 0 < new_base < 1 xtd::math::positive_infinity
a = 0 new_base > 1 xtd::math::negative_infinity
a = xtd::math::positive_infinity 0 < new_base < 1 xtd::math::negative_infinity
a = xtd::math::positive_infinity new_base > 1 xtd::math::positive_infinity
a = 1 new_base = 0 0
a = 1 new_base = xtd::math::positive_infinity 0

◆ log10()

auto xtd::math::log10 ( double value) -> double
staticnodiscard

Returns the base 10 logarithm of a specified number.

Parameters
valueA number whose logarithm is to be found.
Returns
One of the values in the following table.
value parameter Return value
Positive The natural logarithm of d; that is, ln value, or log e value
Zero xtd::math::negative_infinity
Negative xtd::math::NaN
Equal to xtd::math::NaN xtd::math::NaN
Equal to xtd::math::positive_infinity xtd::math::positive_infinity
Remarks
Parameter value is specified as a base 10 number.

◆ max() [1/13]

auto xtd::math::max ( xtd::byte a,
xtd::byte b ) -> xtd::byte
staticnodiscardnoexcept

Returns the larger of two 8-bit unsigned integers.

Parameters
aThe first of two 8-bit unsigned integers to compare.
bThe second of two 8-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [2/13]

auto xtd::math::max ( xtd::decimal a,
xtd::decimal b ) -> xtd::decimal
staticnodiscardnoexcept

Returns the larger of two double single.

Parameters
aThe first of two double single to compare.
bThe second of two double single to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [3/13]

auto xtd::math::max ( double a,
double b ) -> double
staticnodiscardnoexcept

Returns the larger of two double single.

Parameters
aThe first of two double single to compare.
bThe second of two double single to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [4/13]

auto xtd::math::max ( xtd::int16 a,
xtd::int16 b ) -> xtd::int16
staticnodiscardnoexcept

Returns the larger of two 16-bit signed integers.

Parameters
aThe first of two 16-bit signed integers to compare.
bThe second of two 16-bit signed integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [5/13]

auto xtd::math::max ( xtd::int32 a,
xtd::int32 b ) -> xtd::int32
staticnodiscardnoexcept

Returns the larger of two 32-bit signed integers.

Parameters
aThe first of two 32-bit signed integers to compare.
bThe second of two 32-bit signed integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [6/13]

auto xtd::math::max ( xtd::int64 a,
xtd::int64 b ) -> xtd::int64
staticnodiscardnoexcept

Returns the larger of two 64-bit signed integers.

Parameters
aThe first of two 64-bit signed integers to compare.
bThe second of two 64-bit signed integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [7/13]

auto xtd::math::max ( xtd::slong a,
xtd::slong b ) -> xtd::slong
staticnodiscardnoexcept

Returns the larger of two 64-bit signed integers.

Parameters
aThe first of two 64-bit signed integers to compare.
bThe second of two 64-bit signed integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [8/13]

auto xtd::math::max ( xtd::sbyte a,
xtd::sbyte b ) -> xtd::sbyte
staticnodiscardnoexcept

Returns the larger of two 8-bit signed integers.

Parameters
aThe first of two 8-bit signed integers to compare.
bThe second of two 8-bit signed integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [9/13]

auto xtd::math::max ( xtd::single a,
xtd::single b ) -> xtd::single
staticnodiscardnoexcept

Returns the larger of two single single.

Parameters
aThe first of two single single to compare.
bThe second of two single single to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [10/13]

auto xtd::math::max ( xtd::uint16 a,
xtd::uint16 b ) -> xtd::uint16
staticnodiscardnoexcept

Returns the larger of two 16-bit unsigned integers.

Parameters
aThe first of two 16-bit unsigned integers to compare.
bThe second of two 16-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [11/13]

auto xtd::math::max ( xtd::uint32 a,
xtd::uint32 b ) -> xtd::uint32
staticnodiscardnoexcept

Returns the larger of two 32-bit unsigned integers.

Parameters
aThe first of two 32-bit unsigned integers to compare.
bThe second of two 32-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [12/13]

auto xtd::math::max ( xtd::uint64 a,
xtd::uint64 b ) -> xtd::uint64
staticnodiscardnoexcept

Returns the larger of two 64-bit unsigned integers.

Parameters
aThe first of two 64-bit unsigned integers to compare.
bThe second of two 64-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ max() [13/13]

auto xtd::math::max ( xtd::ulong a,
xtd::ulong b ) -> xtd::ulong
staticnodiscardnoexcept

Returns the larger of two 64-bit unsigned integers.

Parameters
aThe first of two 64-bit unsigned integers to compare.
bThe second of two 64-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is larger.

◆ min() [1/13]

auto xtd::math::min ( xtd::byte a,
xtd::byte b ) -> xtd::byte
staticnodiscardnoexcept

Returns the smaller of two 8-bit unsigned integers.

Parameters
aThe first of two 8-bit unsigned integers to compare.
bThe second of two 8-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [2/13]

auto xtd::math::min ( xtd::decimal a,
xtd::decimal b ) -> xtd::decimal
staticnodiscardnoexcept

Returns the smaller of two double single.

Parameters
aThe first of two double single to compare.
bThe second of two double single to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [3/13]

auto xtd::math::min ( double a,
double b ) -> double
staticnodiscardnoexcept

Returns the smaller of two double single.

Parameters
aThe first of two double single to compare.
bThe second of two double single to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [4/13]

auto xtd::math::min ( xtd::int16 a,
xtd::int16 b ) -> xtd::int16
staticnodiscardnoexcept

Returns the smaller of two 16-bit signed integers.

Parameters
aThe first of two 16-bit signed integers to compare.
bThe second of two 16-bit signed integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [5/13]

auto xtd::math::min ( xtd::int32 a,
xtd::int32 b ) -> xtd::int32
staticnodiscardnoexcept

Returns the smaller of two 32-bit signed integers.

Parameters
aThe first of two 32-bit signed integers to compare.
bThe second of two 32-bit signed integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [6/13]

auto xtd::math::min ( xtd::int64 a,
xtd::int64 b ) -> xtd::int64
staticnodiscardnoexcept

Returns the smaller of two 64-bit signed integers.

Parameters
aThe first of two 64-bit signed integers to compare.
bThe second of two 64-bit signed integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [7/13]

auto xtd::math::min ( xtd::slong a,
xtd::slong b ) -> xtd::slong
staticnodiscardnoexcept

Returns the smaller of two 64-bit signed integers.

Parameters
aThe first of two 64-bit signed integers to compare.
bThe second of two 64-bit signed integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [8/13]

auto xtd::math::min ( xtd::sbyte a,
xtd::sbyte b ) -> xtd::sbyte
staticnodiscardnoexcept

Returns the smaller of two 8-bit signed integers.

Parameters
aThe first of two 8-bit signed integers to compare.
bThe second of two 8-bit signed integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [9/13]

auto xtd::math::min ( xtd::single a,
xtd::single b ) -> xtd::single
staticnodiscardnoexcept

Returns the smaller of two single single.

Parameters
aThe first of two single single to compare.
bThe second of two single single to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [10/13]

auto xtd::math::min ( xtd::uint16 a,
xtd::uint16 b ) -> xtd::uint16
staticnodiscardnoexcept

Returns the smaller of two 16-bit unsigned integers.

Parameters
aThe first of two 16-bit unsigned integers to compare.
bThe second of two 16-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [11/13]

auto xtd::math::min ( xtd::uint32 a,
xtd::uint32 b ) -> xtd::uint32
staticnodiscardnoexcept

Returns the smaller of two 32-bit unsigned integers.

Parameters
aThe first of two 32-bit unsigned integers to compare.
bThe second of two 32-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [12/13]

auto xtd::math::min ( xtd::uint64 a,
xtd::uint64 b ) -> xtd::uint64
staticnodiscardnoexcept

Returns the smaller of two 64-bit unsigned integers.

Parameters
aThe first of two 64-bit unsigned integers to compare.
bThe second of two 64-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ min() [13/13]

auto xtd::math::min ( xtd::ulong a,
xtd::ulong b ) -> xtd::ulong
staticnodiscardnoexcept

Returns the smaller of two 64-bit unsigned integers.

Parameters
aThe first of two 64-bit unsigned integers to compare.
bThe second of two 64-bit unsigned integers to compare.
Returns
Parameter a or b, whichever is smaller.

◆ pow()

auto xtd::math::pow ( double x,
double y ) -> double
staticnodiscard

Returns a specified number raised to the specified power.

Parameters
xA double-precision floating-point number to be raised to a power.
yA double-precision floating-point number that specifies a power.
Returns
The number x raised to the power y.
Remarks
The following table indicates the return value when various values or ranges of values are specified for the x and y parameters. For more information, see Double::math::positive_infinity, Double::math::negative_infinity, and Double::NaN.
Parameters Return value
x or y = math::NaN. math::NaN
x = Any value except math::NaN; y = 0. 1
x = math::negative_infinity; y < 0. 0
x = math::negative_infinity; y is positive odd integer. math::negative_infinity
x = math::negative_infinity; y is positive but not an odd integer. math::positive_infinity
x < 0 but not math::negative_infinity; y is not an integer, math::negative_infinity, or math::positive_infinity. math::NaN
x = -1; y = math::negative_infinity or math::positive_infinity. math::NaN
-1 < x < 1; y = math::negative_infinity. math::positive_infinity
-1 < x < 1; y = math::positive_infinity. 0
x < -1 or x > 1; y = math::negative_infinity. 0
x < -1 or x > 1; y = math::positive_infinity. math::positive_infinity
x = 0; y < 0. math::positive_infinity
x = 0; y > 0. 0
x = 1; y is any value except math::NaN. 1
x = math::positive_infinity; y < 0 0
x = math::positive_infinity; y > 0. math::positive_infinity

◆ radians_to_degrees()

auto xtd::math::radians_to_degrees ( double radians) -> double
staticnodiscardnoexcept

Convert radians to degrees.

Parameters
radiansA double-precision floating-point number.
Returns
A converted radians from degrees.

◆ round() [1/4]

auto xtd::math::round ( xtd::decimal value) -> xtd::decimal
staticnodiscard

Rounds a double-precision floating-point value to the nearest integral value.

Parameters
valueA double-precision floating-point number to be rounded.
Returns
The integer nearest value. If the fractional component of a is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a double instead of an integral type.

◆ round() [2/4]

auto xtd::math::round ( xtd::decimal value,
xtd::int32 decimals ) -> xtd::decimal
staticnodiscard

Rounds a xtd::decimal value to a specified number of fractional digits.

Parameters
valueA double-precision floating-point number to be rounded.
decimalsThe number of xtd::decimal places in the return value.
Returns
The number nearest to d that contains a number of fractional digits equal to decimals.

◆ round() [3/4]

auto xtd::math::round ( double value) -> double
staticnodiscard

Rounds a double-precision floating-point value to the nearest integral value.

Parameters
valueA double-precision floating-point number to be rounded.
Returns
The integer nearest value. If the fractional component of a is halfway between two integers, one of which is even and the other odd, then the even number is returned. Note that this method returns a double instead of an integral type.

◆ round() [4/4]

auto xtd::math::round ( double value,
xtd::int32 decimals ) -> double
staticnodiscard

Rounds a xtd::decimal value to a specified number of fractional digits.

Parameters
valueA double-precision floating-point number to be rounded.
decimalsThe number of xtd::decimal places in the return value.
Returns
The number nearest to d that contains a number of fractional digits equal to decimals.

◆ sign() [1/8]

auto xtd::math::sign ( xtd::decimal value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a double-precision floating-point number.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.
Exceptions
xtd::arithmetic_exceptionvalue is equal to NaN.

◆ sign() [2/8]

auto xtd::math::sign ( double value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a double-precision floating-point number.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.
Exceptions
xtd::arithmetic_exceptionvalue is equal to NaN.

◆ sign() [3/8]

auto xtd::math::sign ( xtd::int16 value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a 16-bit signed integer.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.

◆ sign() [4/8]

auto xtd::math::sign ( xtd::int32 value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a 32-bit signed integer.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.

◆ sign() [5/8]

auto xtd::math::sign ( xtd::int64 value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a 64-bit signed integer.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.

◆ sign() [6/8]

auto xtd::math::sign ( xtd::slong value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a 64-bit signed integer.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.

◆ sign() [7/8]

auto xtd::math::sign ( xtd::sbyte value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of an 8-bit signed integer.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.

◆ sign() [8/8]

auto xtd::math::sign ( xtd::single value) -> xtd::int32
staticnodiscard

Returns a value indicating the sign of a single-precision floating-point number.

Parameters
valueA signed number.
Returns
xtd::int32 A number that indicates the sign of value, as shown in the following table.
Return value Meaning
-1 value is less than zero.
0 value is equal to zero.
1 value is greater than zero.
Exceptions
xtd::arithmetic_exceptionvalue is equal to NaN.

◆ sin()

auto xtd::math::sin ( double value) -> double
staticnodiscard

Returns the sine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
double The sine of value. If value is equal to math::NaN, math::negative_infinity, or math::positiveI_infinity, this method returns math::NaN.

◆ sinh()

auto xtd::math::sinh ( double value) -> double
staticnodiscard

Returns the hyperbolic sine of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
double The sine of a. If a is equal to math::NaN, math::negative_infinity, or math::positive_infinity, this method returns math::NaN.

◆ sqrt()

auto xtd::math::sqrt ( double value) -> double
staticnodiscard

Returns the square root of a specified number.

Parameters
valueThe number whose square root is to be found.
Returns
One of the values in the following table.
value parameter Return value
Zero or positive The positive square root of d.
Negative math::NaN
Equals math::NaN math::NaN
Equals math::positive_infinity math::positive_infinity

◆ tan()

auto xtd::math::tan ( double value) -> double
staticnodiscard

Returns the tangent of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The tangent of value. If value is equal to math::NaN, math::negative_infinity, or math::positive_infinity, this method returns math::NaN.

◆ tanh()

auto xtd::math::tanh ( double value) -> double
staticnodiscard

Returns the hyperbolic tangent of the specified angle.

Parameters
valueAn angle, measured in radians.
Returns
The hyperbolic tangent of value. If value is equal to math::negative_infinity, this method returns -1. If value is equal to math::positive_infinity, this method returns 1. If value is equal to math::NaN, this method returns math::NaN.

◆ truncate() [1/2]

auto xtd::math::truncate ( xtd::decimal value) -> xtd::decimal
staticnodiscard

Calculates the integral part of a specified double-precision floating-point number.

Parameters
valueA number to truncate.
Returns
The integral part of d; that is, the number that remains after any fractional digits have been discarded, or one of the values listed in the following table.
value Return value
NaN NaN
NegativeInfinity NegativeInfinity
PositiveInfinity PositiveInfinity

◆ truncate() [2/2]

auto xtd::math::truncate ( double value) -> double
staticnodiscard

Calculates the integral part of a specified double-precision floating-point number.

Parameters
valueA number to truncate.
Returns
The integral part of d; that is, the number that remains after any fractional digits have been discarded, or one of the values listed in the following table.
value Return value
math::NaN math::NaN
math::negative_infinity math::negative_infinity
math::positive_infinity math::positive_infinity

◆ is_infinity()

auto xtd::math::is_infinity ( double value) -> bool
staticnodiscardnoexcept

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

Parameters
valueA double-precision floating-point number.
Returns
true if value evaluates to xtd::math::positive_infinity or xtd::math::negative_infinity; otherwise, false.
Deprecated
Replaced by xtd::double_object::is_infinity - Will be removed in version 1.2.0.

◆ is_negative_infinity()

auto xtd::math::is_negative_infinity ( double value) -> bool
staticnodiscardnoexcept

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

Parameters
valueA double-precision floating-point number.
Returns
true if value evaluates to xtd::math::negative_infinity; otherwise, false.
Deprecated
Replaced by xtd::double_object::is_negative_infinity - Will be removed in version 1.2.0.

◆ is_positive_infinity()

auto xtd::math::is_positive_infinity ( double value) -> bool
staticnodiscardnoexcept

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

Parameters
valueA double-precision floating-point number.
Returns
true if value evaluates to xtd::math::positive_infinity; otherwise, false.
Deprecated
Replaced by xtd::double_object::is_positive_infinity - Will be removed in version 1.2.0.

◆ is_NaN()

auto xtd::math::is_NaN ( double value) -> bool
staticnodiscardnoexcept

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

Parameters
valueA double-precision floating-point number.
Returns
true if value evaluates to not a number; otherwise, false.
Deprecated
Replaced by xtd::double_object::is_NaN - Will be removed in version 1.2.0.

Member Data Documentation

◆ e

double xtd::math::e
staticconstexpr

Represents the natural logarithmic base, specified by the constant, e. This field is constant.

Remarks
The value of this field is 2.7182818284590452354.

◆ pi

double xtd::math::pi
staticconstexpr

Represents the ratio of the circumference of a circle to its diameter, specified by the constant, π. This field is constant.

Remarks
The value of this field is 3.14159265358979323846.

◆ tau

double xtd::math::tau
staticconstexpr

Represents the number of radians in one turn, specified by the constant, τ.

Remarks
The value of this field is 2.7182818284590451.

◆ epsilon

auto xtd::math::epsilon
staticconstexpr

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

Remarks
The value of this field is 4.94066e-324.
Deprecated
Replaced by xtd::double_object::epsilon - Will be removed in version 1.2.0.

◆ infinity

auto xtd::math::infinity
staticconstexpr

Represents infinity. This field is constant.

Remarks
The value of this field is std::numeric_limits<double>::infinity().
Deprecated
Replaced by xtd::double_object::positive_infinity - Will be removed in version 1.2.0.

◆ max_value

auto xtd::math::max_value
staticconstexpr

Represents the largest possible value of double. This field is constant.

Remarks
The value of this field is 1.7976931348623157E+308.
Deprecated
Replaced by xtd::double_object::max_value - Will be removed in version 1.2.0.

◆ min_value

auto xtd::math::min_value
staticconstexpr

Represents the smallest possible value of double. This field is constant.

Remarks
The value of this field is -1.7976931348623157E+308.
Deprecated
Replaced by xtd::double_object::min_value - Will be removed in version 1.2.0.

◆ NaN

auto xtd::math::NaN
staticconstexpr

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

Remarks
The value of this field is std::numeric_limits<double>::quiet_NaN().
Deprecated
Replaced by xtd::double_object::NaN - Will be removed in version 1.2.0.

◆ negative_infinity

auto xtd::math::negative_infinity
staticconstexpr

Represents negative infinity. This field is constant.

Remarks
The value of this field is -std::numeric_limits<double>::infinity().
Deprecated
Replaced by xtd::double_object::negative_infinity - Will be removed in version 1.2.0.

◆ positive_infinity

auto xtd::math::positive_infinity
staticconstexpr

Represents positive infinity. This field is constant.

Remarks
The value of this field is std::numeric_limits<double>::infinity().
Deprecated
Replaced by xtd::double_object::positive_infinity - Will be removed in version 1.2.0.

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