1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
use ;
/// ### add_vec_num(x, y)
///
/// Operation Function
///
/// The `add_vec_num` function takes a slice `x` of floating-point numbers and a float `y`,
/// performs an element-wise addition on all elements of `x` and `y`, and returns a new vector containing the resulting sums.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{add, add_vec_num, fround_vec};
/// assert_eq!(add(0.1, 0.2), 0.30000000000000004);
/// assert_eq!(add(0.1, 0.2) as f32, 0.3);
/// assert_eq!(add_vec_num(&[0.0, 0.1, 0.2], 0.1), [0.1, 0.2, 0.30000000000000004]);
/// assert_eq!(fround_vec(&add_vec_num(&[0.0, 0.1, 0.2], 0.1)), [0.1, 0.2, 0.3]);
/// ```
/// <small>End Fun Doc</small>
/// ### subt_vec_num(x, y)
///
/// Operation Function
///
/// The `subt_vec_num` subtracts a given float `y` from every element in a slice `x` of floats,
/// returning a new vector containing the differences.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{subt, subt_vec_num, fround_vec};
/// assert_eq!(subt(0.1, 0.2), -0.1);
/// assert_eq!(subt(0.1, 0.2) as f32, -0.1);
/// assert_eq!(subt_vec_num(&[0.0, 0.1, 0.2, 0.3], 0.3), [-0.3, -0.19999999999999998, -0.09999999999999998, 0.0]);
/// assert_eq!(fround_vec(&subt_vec_num(&[0.0, 0.1, 0.2, 0.3], 0.3)), [-0.3, -0.2, -0.1, 0.0]);
/// ```
/// <small>End Fun Doc</small>
/// ### mult_vec_num(x, y)
///
/// Operation Function
///
/// The `mult_vec_num` function multiplies a given float `y` with every element in a slice `x` of floats,
/// returning a new vector containing the result.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{mult, mult_vec_num, fround_vec};
/// assert_eq!(mult(0.1, 0.2), 0.020000000000000004);
/// assert_eq!(mult(0.1, 0.2) as f32, 0.02);
/// assert_eq!(mult_vec_num(&[0.0, 0.1, 0.2], 0.1), [0.0, 0.010000000000000002, 0.020000000000000004]);
/// assert_eq!(fround_vec(&mult_vec_num(&[0.0, 0.1, 0.2], 0.1)), [0.0, 0.01, 0.02]);
/// ```
/// <small>End Fun Doc</small>
/// ### divi_vec_num(x, y)
///
/// Operation Function
///
/// The `divi_vec_num` function divides every element in a slice `x` of floats by a given float `y`,
/// returning a new vector containing the result.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{divi, divi_vec_num, fround_vec};
/// assert_eq!(divi(0.2, 0.3), 0.6666666666666667);
/// assert_eq!(divi(0.2, 0.3) as f32, 0.6666667);
/// //assert_eq!(divi_vec_num(&[0.0, 0.1, 0.2, 0.3], 0.2), [0.0, 0.5, 1.0, 1.4999999999999998]);
/// //assert_eq!(fround_vec(divi_vec_num(&[0.0, 0.1, 0.2, 0.3], 0.2)), [0.0, 0.5, 1.0, 1.5]);
/// ```
/// <small>End Fun Doc</small>
/// ### pow_vec_num(x, y)
///
/// Operation Function
///
/// The `pow_vec_num` function computes the power of every element in a slice `x` of positive floats using a
/// given float `y` as exponent, returning a new vector containing the results.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{pow, pow_vec_num, INF_F64};
/// assert_eq!(pow(0.0, 1.0), 0.0);
/// assert_eq!(pow(2.0 , -3.0), 0.125);
/// assert_eq!(pow_vec_num(&[3.0, 0.0, 4.0, INF_F64], 2.0), [9.0, 0.0, 16.0, INF_F64]);
/// ```
/// <small>End Fun Doc</small>
/// ### rem_vec_num(x, y)
///
/// Operation Function
///
/// The `rem_vec_num` function computes the remainders obtained after dividing each element in `x` by another fixed number `y`, and accumulates these leftovers into a new vector.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{rem, rem_vec_num, is_nan_f64, INF_F64};
/// assert!(is_nan_f64(rem(0.0, 0.0)));
/// assert!(is_nan_f64(rem(1.0, 0.0)));
/// assert!(is_nan_f64(rem(INF_F64, 0.0)));
/// assert!(is_nan_f64(rem(INF_F64, 2.0)));
/// assert!(is_nan_f64(rem(INF_F64, INF_F64)));
/// assert!(is_nan_f64(rem(INF_F64, INF_F64)));
/// assert_eq!(rem_vec_num(&[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], 3.0), [1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0]);
/// ```
/// <small>End Fun Doc</small>
/// ### nrt_vec_num(x, n)
///
/// Operation Function
///
/// The `nrt_vec_num` function calculates the `n-th` root of each element in the given vector `x`, using the given power `n`,
/// and returns the results as a vector of floating-point numbers.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{nrt, nrt_vec_num, fix64_vec};
/// assert_eq!(nrt(27.0, 3.0), 3.0);
/// assert_eq!(nrt_vec_num(&[27.0, 64.0, 125.0], 3.0), [3.0, 3.9999999999999996, 4.999999999999999]);
/// assert_eq!(fix64_vec(&nrt_vec_num(&[27.0, 64.0, 125.0], 3.0)), [3.0, 4.0, 5.0]);
/// ```
/// <small>End Fun Doc</small>
/// ### perimeter_vec_num(x, y)
///
/// Geometry Function
///
/// The `perimeter_vec_num` function calculates the perimeter of each element in a slice `x` of floats, given a reference `y`, and returns a new vector containing the perimeters.
///
/// ### Examples
/// ```rust
/// use mathlab::math::{perimeter_vec_num, INF_F64 as inf};
/// assert_eq!(perimeter_vec_num(&[0.0, 1.0, 2.0, inf], 1.0), [2.0, 4.0, 6.0, inf]);
/// ```
/// <small>End Fun Doc</small>