mathlab/constants/
mod.rs

1/// ### E
2///
3/// Mathematical constant
4///
5/// The Number e (Euler's number)
6///
7/// ### Example
8/// ```rust
9/// use mathlab::math::E;
10/// assert_eq!(E, 2.718281828459045);
11/// ```
12/// <small>End Con Doc</small>
13pub const E: f64 = 2.718281828459045;
14
15/// ### H_PI
16///
17/// Mathematical constant
18///
19/// Half Pi (π / 2)
20///
21/// (3.1415926536 / 2) = 1.5707963268
22///
23/// ### Example
24/// ```rust
25/// use mathlab::math::{H_PI, PI};
26/// assert_eq!(H_PI, PI / 2.0);
27/// assert_eq!(H_PI, 1.5707963268);
28/// ```
29/// <small>End Con Doc</small>
30pub const H_PI: f64 = 1.5707963268;
31
32/// ### PI
33///
34/// Mathematical constant
35///
36/// The Number Pi
37///
38/// (21.9911485752 / 7) = 3.1415926536
39///
40/// ### Example
41/// ```rust
42/// use mathlab::math::PI;
43/// assert_eq!(PI, 3.1415926536);
44/// ```
45/// <small>End Con Doc</small>
46pub const PI: f64 = 3.1415926536;
47
48/// ### Q_PI
49///
50/// Mathematical constant
51///
52/// Quarter Pi (π / 4)
53///
54/// (3.1415926536 / 4) = 0.7853981634
55///
56/// ### Example
57/// ```rust
58/// use mathlab::math::{Q_PI, PI};
59/// assert_eq!(Q_PI, PI / 4.0);
60/// assert_eq!(Q_PI, 0.7853981634);
61/// ```
62/// <small>End Con Doc</small>
63pub const Q_PI: f64 = 0.7853981634;
64
65/// ### PHI
66///
67/// Mathematical constant
68///
69/// The Golden Ratio (Phi)
70///
71/// (1 + sqrt(5)) / 2 = 1.618033988749895
72///
73/// ### Example
74/// ```rust
75/// use mathlab::math::PHI;
76/// assert_eq!(PHI, 1.618033988749895);
77/// ```
78/// <small>End Con Doc</small>
79pub const PHI: f64 = 1.618033988749895;
80
81/// ### TAU
82///
83/// Mathematical constant
84///
85/// Tau is a circle constant and the value is equivalent to 2π
86///
87/// (2 * PI) = 6.2831853072
88///
89/// ### Example
90/// ```rust
91/// use mathlab::math::{TAU, PI};
92/// assert_eq!(TAU, 2.0 * PI);
93/// assert_eq!(TAU, 6.2831853072);
94/// ```
95/// <small>End Con Doc</small>
96pub const TAU: f64 = 6.2831853072;
97
98/// ### LN2
99///
100/// Mathematical constant
101///
102/// The natural logarithm of 2
103///
104/// ### Example
105/// ```rust
106/// use mathlab::math::LN2;
107/// assert_eq!(LN2, 0.693147180559945);
108/// ```
109/// <small>End Con Doc</small>
110pub const LN2: f64 = 0.693147180559945;
111
112/// ### LN10
113///
114/// Mathematical constant
115///
116/// The natural logarithm of 10
117///
118/// ### Example
119/// ```rust
120/// use mathlab::math::LN10;
121/// assert_eq!(LN10, 2.302585092994046);
122/// ```
123/// <small>End Con Doc</small>
124pub const LN10: f64 = 2.302585092994046;
125
126/// ### LOG2E
127///
128/// Mathematical constant
129///
130/// The base 2 logarithm of E
131///
132/// ### Example
133/// ```rust
134/// use mathlab::math::LOG2E;
135/// assert_eq!(LOG2E, 1.442695040888963);
136/// ```
137/// <small>End Con Doc</small>
138pub const LOG2E: f64 = 1.442695040888963;
139
140/// ### LOG10E
141///
142/// Mathematical constant
143///
144/// The base 10 logarithm of E
145///
146/// ### Example
147/// ```rust
148/// use mathlab::math::LOG10E;
149/// assert_eq!(LOG10E, 0.434294481903252);
150/// ```
151/// <small>End Con Doc</small>
152pub const LOG10E: f64 = 0.434294481903252;
153
154/// ### NAN_F32
155///
156/// IEEE 754 Standard
157///
158/// The `NAN_F32` constant conforms to the `IEEE 754` specification for `single-precision` floating-point
159/// representation of `NaN`, denoting undefined outcomes encountered during particular operations.
160///
161/// ### Example
162/// ```rust
163/// use mathlab::math::{NAN_F64, is_nan_f32, f64_to_f32, add};
164/// assert!(is_nan_f32(add(NAN_F64, 1.0) as f32));
165/// assert!(is_nan_f32(f64_to_f32(add(NAN_F64, 1.0))));
166/// assert_eq!(assert!(is_nan_f32(add(NAN_F64, 1.0) as f32)), assert!(is_nan_f32(f64_to_f32(add(NAN_F64, 1.0)))));
167/// ```
168/// <small>End Con Doc</small>
169pub const NAN_F32: f32 = 0.0_f32 / 0.0_f32;
170
171/// ### INF_F32
172///
173/// IEEE 754 Standard
174///
175/// The `INF_F32` constant conforms to the `IEEE 754` guideline governing `single-precision` floating-point `positive infinity` depiction.
176///
177/// ### Example
178/// ```rust
179/// use mathlab::math::INF_F32;
180/// assert_eq!(2.0 / 0.0, INF_F32);
181/// ```
182/// <small>End Con Doc</small>
183pub const INF_F32: f32 = 1.0_f32 / 0.0_f32;
184
185/// ### NINF_F32
186///
187/// IEEE 754 Standard
188///
189/// The `NINF_F32` constant conforms to the `IEEE 754` guideline governing `single-precision` floating-point `negative infinity` depiction.
190///
191/// ### Example
192/// ```rust
193/// use mathlab::math::NINF_F32;
194/// assert_eq!(-2.0 / 0.0, NINF_F32);
195/// ```
196/// <small>End Con Doc</small>
197pub const NINF_F32: f32 = -1.0_f32 / 0.0_f32;
198
199/// ### NAN_F64
200///
201/// IEEE 754 Standard
202///
203/// The `NAN_F64` constant conforms to the `IEEE 754` specification for `double-precision` floating-point
204/// representation of `NaN`, denoting undefined outcomes encountered during particular operations.
205///
206/// ### Example
207/// ```rust
208/// use mathlab::math::{NAN_F64, is_nan_f64, add};
209/// assert!(is_nan_f64(add(NAN_F64, 1.0)));
210/// ```
211/// <small>End Con Doc</small>
212pub const NAN_F64: f64 = 0.0_f64 / 0.0_f64;
213
214/// ### INF_F64
215///
216/// IEEE 754 Standard
217///
218/// The `INF_F64` constant conforms to the `IEEE 754` guideline governing `double-precision` floating-point `positive infinity` depiction.
219///
220/// ### Example
221/// ```rust
222/// use mathlab::math::INF_F64;
223/// assert_eq!(2.0 / 0.0, INF_F64);
224/// ```
225/// <small>End Con Doc</small>
226pub const INF_F64: f64 = 1.0_f64 / 0.0_f64;
227
228/// ### NINF_F64
229///
230/// IEEE 754 Standard
231///
232/// The `NINF_F64` constant conforms to the `IEEE 754` guideline governing double-precision floating-point `negative infinity` depiction.
233///
234/// ### Example
235/// ```rust
236/// use mathlab::math::NINF_F64;
237/// assert_eq!(-2.0 / 0.0, NINF_F64);
238/// ```
239/// <small>End Con Doc</small>
240pub const NINF_F64: f64 = -1.0_f64 / 0.0_f64;