extended_matrix_float/
lib.rs

1mod tests;
2
3
4pub trait MyFloatTrait
5{
6    fn my_powi(&self, n: i32) -> Self;
7    fn my_sqrt(&self) -> Self;
8    fn my_acos(&self) -> Self;
9    fn my_cos(&self) -> Self;
10    fn my_sin(&self) -> Self;
11    fn my_abs(&self) -> Self;
12    fn my_asin(&self) -> Self;
13    fn my_atan2(&self, other: &Self) -> Self;
14    fn my_atan(&self) -> Self;
15    fn my_to_degrees(&self) -> Self;
16    fn my_is_nan(&self) -> bool;
17}
18
19
20impl MyFloatTrait for f32
21{
22    fn my_powi(&self, n: i32) -> Self
23    {
24        self.powi(n)
25    }
26
27
28    fn my_sqrt(&self) -> Self
29    {
30        self.sqrt()
31    }
32
33
34    fn my_acos(&self) -> Self
35    {
36        self.acos()
37    }
38
39
40    fn my_cos(&self) -> Self
41    {
42        self.cos()
43    }
44
45
46    fn my_sin(&self) -> Self
47    {
48        self.sin()
49    }
50
51
52    fn my_abs(&self) -> Self
53    {
54        self.abs()
55    }
56
57
58    fn my_asin(&self) -> Self
59    {
60        self.asin()
61    }
62
63
64    fn my_atan2(&self, other: &Self) -> Self
65    {
66        self.atan2(*other)
67    }
68
69
70    fn my_atan(&self) -> Self
71    {
72        self.atan()
73    }
74
75
76    fn my_to_degrees(&self) -> Self
77    {
78        self.to_degrees()
79    }
80
81
82    fn my_is_nan(&self) -> bool 
83    {
84        self.is_nan()    
85    }
86}
87
88
89impl MyFloatTrait for f64
90{
91    fn my_powi(&self, n: i32) -> Self
92    {
93        self.powi(n)
94    }
95
96
97    fn my_sqrt(&self) -> Self
98    {
99        self.sqrt()
100    }
101
102
103    fn my_acos(&self) -> Self
104    {
105        self.acos()
106    }
107
108
109    fn my_cos(&self) -> Self
110    {
111        self.cos()
112    }
113
114
115    fn my_sin(&self) -> Self
116    {
117        self.sin()
118    }
119
120
121    fn my_abs(&self) -> Self
122    {
123        self.abs()
124    }
125
126
127    fn my_asin(&self) -> Self
128    {
129        self.asin()
130    }
131
132
133    fn my_atan2(&self, other: &Self) -> Self
134    {
135        self.atan2(*other)
136    }
137
138
139    fn my_atan(&self) -> Self
140    {
141        self.atan()
142    }
143
144
145    fn my_to_degrees(&self) -> Self
146    {
147        self.to_degrees()
148    }
149
150
151    fn my_is_nan(&self) -> bool 
152    {
153        self.is_nan()    
154    }
155}