xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
math.h
Go to the documentation of this file.
1 #pragma once
4 #include "static.h"
5 #include "types.h"
6 #include <limits>
7 
9 namespace xtd {
20  class math static_ {
21  public:
24  static constexpr double e = 2.7182818284590452354;
27  static constexpr double epsilon = 4.94066e-324;
30  static constexpr double infinity = std::numeric_limits<double>::infinity();
33  static constexpr double max_value = std::numeric_limits<double>::max();
36  static constexpr double min_value = std::numeric_limits<double>::lowest();
39  static constexpr double NaN = std::numeric_limits<double>::quiet_NaN();
42  static constexpr double negative_infinity = -infinity;
45  static constexpr double pi = 3.14159265358979323846;
48  static constexpr double positive_infinity = +infinity;
51  static constexpr double tau = 2.7182818284590451;
52 
56  static decimal_t abs(decimal_t value);
57 
61  static double abs(double value);
62 
66  static float abs(float value);
67 
72  static int16_t abs(int16_t value);
73 
78  static int32_t abs(int32_t value);
79 
84  static int64_t abs(int64_t value);
85 
90  static sbyte_t abs(sbyte_t value);
91 
96  static llong_t abs(llong_t value);
97 
101  static double acos(double value);
102 
106  static double asin(double value);
107 
111  static double atan(double value);
112 
127  static double atan2(double y, double x);
128 
133  static int64_t big_mul(int32_t a, int32_t b);
134 
138  static decimal ceiling(decimal value);
139 
143  static double ceiling(double value);
144 
148  static double cos(double value);
149 
153  static double cosh(double value);
154 
158  static double degrees_to_radians(double degrees);
159 
165  static int32_t div_rem(int32_t dividend, int32_t divisor, int32_t& remainder);
166 
172  static int64_t div_rem(int64_t dividend, int64_t divisor, int64_t& remainder);
173 
177  static double exp(double value);
178 
182  static decimal_t floor(decimal_t value);
183 
187  static double floor(double value);
188 
195  static double ieee_remainder(double dividend, double divisor);
196 
200  static bool is_infinity(double value);
201 
205  static bool is_negative_infinity(double value);
206 
210  static bool is_positive_infinity(double value);
211 
215  static bool is_NaN(double value);
216 
228  static double log(double value);
229 
250  static double log(double a, double new_base);
251 
263  static double log10(double value);
264 
269  static byte_t max(byte_t a, byte_t b);
270 
275  static decimal_t max(decimal_t a, decimal_t b);
276 
281  static double max(double a, double b);
282 
287  static int16_t max(int16_t a, int16_t b);
288 
293  static int32_t max(int32_t a, int32_t b);
294 
299  static int64_t max(int64_t a, int64_t b);
300 
305  static llong_t max(llong_t a, llong_t b);
306 
311  static sbyte_t max(sbyte_t a, sbyte_t b);
312 
317  static float max(float a, float b);
318 
323  static uint16_t max(uint16_t a, uint16_t b);
324 
329  static uint32_t max(uint32_t a, uint32_t b);
330 
335  static uint64_t max(uint64_t a, uint64_t b);
336 
341  static ullong_t max(ullong_t a, ullong_t b);
342 
347  static byte_t min(byte_t a, byte_t b);
348 
353  static decimal_t min(decimal_t a, decimal_t b);
354 
359  static double min(double a, double b);
360 
365  static int16_t min(int16_t a, int16_t b);
366 
371  static int32_t min(int32_t a, int32_t b);
372 
377  static int64_t min(int64_t a, int64_t b);
378 
383  static llong_t min(llong_t a, llong_t b);
384 
389  static sbyte_t min(sbyte_t a, sbyte_t b);
390 
395  static float min(float a, float b);
396 
401  static uint16_t min(uint16_t a, uint16_t b);
402 
407  static uint32_t min(uint32 a, uint32 b);
408 
413  static uint64 min(uint64_t a, uint64_t b);
414 
419  static ullong_t min(ullong_t a, ullong_t b);
420 
444  static double pow(double x, double y);
445 
449  static double radians_to_degrees(double radians);
450 
454  static decimal_t round(decimal_t value);
455 
460  static decimal_t round(decimal_t value, int32_t decimals);
461 
465  static double round(double value);
466 
471  static double round(double value, int32_t decimals);
472 
482  static int32_t sign(decimal_t value);
483 
493  static int32_t sign(double value);
494 
503  static int32_t sign(int16_t value);
504 
513  static int32_t sign(int32_t value);
514 
523  static int32_t sign(int64_t value);
524 
533  static int32_t sign(llong_t value);
534 
543  static int32_t sign(sbyte_t value);
544 
554  static int32_t sign(float value);
555 
559  static double sin(double value);
560 
564  static double sinh(double value);
565 
575  static double sqrt(double value);
576 
580  static double tan(double value);
581 
585  static double tanh(double value);
586 
595  static decimal_t truncate(decimal_t value);
596 
605  static double truncate(double value);
606  };
607 }
static constexpr double NaN
Represents not a number (NaN). This field is constant.
Definition: math.h:39
Contains xtd::static_object class.
Contains xtd fundamental types.
static constexpr double epsilon
Represents the smallest positive Double value greater than zero. This field is constant.
Definition: math.h:27
static int32_t sign(decimal_t value)
Returns a value indicating the sign of a double-precision floating-point number.
static bool is_NaN(double value)
Returns a value indicating whether the specified number evaluates to not a number.
#define static_
This keyword is use to represent a static object. A static object can&#39;t be instantiated (constructors...
Definition: static.h:38
static double sin(double value)
Returns the sine of the specified angle.
Provides constants and static methods for trigonometric, logarithmic, and other common mathematical f...
Definition: math.h:20
static double pow(double x, double y)
Returns a specified number raised to the specified power.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
static decimal_t round(decimal_t value)
Rounds a double-precision floating-point value to the nearest integral value.
static decimal_t abs(decimal_t value)
Returns the absolute value of a decimal number.
static double atan2(double y, double x)
Returns the angle whose tangent is the specified number.
static decimal_t floor(decimal_t value)
Returns the largest integer less than or equal to the specified decimal number.
static double atan(double value)
Returns the angle whose tangent is the specified number.
static double acos(double value)
Returns the angle whose cosine is the specified number.
static constexpr double tau
Represents the number of radians in one turn, specified by the constant, τ.
Definition: math.h:51
static double cosh(double value)
Returns the hyperbolic cosine of the specified angle.
uint32_t uint32
Represents a 32-bit unsigned integer.
Definition: types.h:211
uint64_t uint64
Represents a 64-bit unsigned integer.
Definition: types.h:219
static bool is_negative_infinity(double value)
Returns a value indicating whether the specified number evaluates to negative infinity.
static bool is_infinity(double value)
Returns a value indicating whether the specified number evaluates to negative or positive infinity...
static bool is_positive_infinity(double value)
Returns a value indicating whether the specified number evaluates to positive infinity.
static double sinh(double value)
Returns the hyperbolic sine of the specified angle.
static double tanh(double value)
Returns the hyperbolic tangent of the specified angle.
static double ieee_remainder(double dividend, double divisor)
Returns the remainder resulting from the division of a specified number by another specified number...
static constexpr double pi
Represents the ratio of the circumference of a circle to its diameter, specified by the constant...
Definition: math.h:45
static constexpr double max_value
Represents the largest possible value of double. This field is constant.
Definition: math.h:33
static byte_t min(byte_t a, byte_t b)
Returns the smaller of two 8-bit unsigned integers.
static double radians_to_degrees(double radians)
Convert radians to degrees.
static int32_t div_rem(int32_t dividend, int32_t divisor, int32_t &remainder)
Calculates the quotient of two 32-bit signed integers and also returns the remainder in an output par...
static double tan(double value)
Returns the tangent of the specified angle.
static double log10(double value)
Returns the base 10 logarithm of a specified number.
static decimal_t truncate(decimal_t value)
Calculates the integral part of a specified double-precision floating-point number.
static decimal ceiling(decimal value)
Returns the smallest integer greater than or equal to the specified double-precision floating-point n...
static double degrees_to_radians(double degrees)
Convert degrees to radians.
static constexpr double infinity
Represents infinity. This field is constant.
Definition: math.h:30
static int64_t big_mul(int32_t a, int32_t b)
Produces the full product of two 32-bit numbers.
static double asin(double value)
Returns the angle whose sine is the specified number.
static byte_t max(byte_t a, byte_t b)
Returns the larger of two 8-bit unsigned integers.
static constexpr double min_value
Represents the smallest possible value of double. This field is constant.
Definition: math.h:36
static double log(double value)
Returns the natural (base e) logarithm of a specified number.
decimal_t decimal
Represents a decimal-precision floating-point number.
Definition: types.h:113
static double exp(double value)
Returns e raised to the specified power.
static constexpr double positive_infinity
Represents positive infinity. This field is constant.
Definition: math.h:48
static double sqrt(double value)
Returns the square root of a specified number.
static constexpr double e
Represents the natural logarithmic base, specified by the constant, e. This field is constant...
Definition: math.h:24
static constexpr double negative_infinity
Represents negative infinity. This field is constant.
Definition: math.h:42
static double cos(double value)
Returns the cosine of the specified angle.