29
29
* to produce the hexadecimal values shown.
30
30
*/
31
31
32
- use core:: f64;
33
-
34
32
use super :: fabs;
35
33
36
34
const ATANHI : [ f64 ; 4 ] = [
@@ -134,19 +132,19 @@ pub fn atan(x: f64) -> f64 {
134
132
135
133
#[ cfg( test) ]
136
134
mod tests {
137
- use core:: f64;
135
+ use core:: f64:: consts ;
138
136
139
137
use super :: atan;
140
138
141
139
#[ test]
142
140
fn sanity_check ( ) {
143
141
for ( input, answer) in [
144
- ( 3.0_f64 . sqrt ( ) / 3.0 , f64 :: consts:: FRAC_PI_6 ) ,
145
- ( 1.0 , f64 :: consts:: FRAC_PI_4 ) ,
146
- ( 3.0_f64 . sqrt ( ) , f64 :: consts:: FRAC_PI_3 ) ,
147
- ( -3.0_f64 . sqrt ( ) / 3.0 , -f64 :: consts:: FRAC_PI_6 ) ,
148
- ( -1.0 , -f64 :: consts:: FRAC_PI_4 ) ,
149
- ( -3.0_f64 . sqrt ( ) , -f64 :: consts:: FRAC_PI_3 ) ,
142
+ ( 3.0_f64 . sqrt ( ) / 3.0 , consts:: FRAC_PI_6 ) ,
143
+ ( 1.0 , consts:: FRAC_PI_4 ) ,
144
+ ( 3.0_f64 . sqrt ( ) , consts:: FRAC_PI_3 ) ,
145
+ ( -3.0_f64 . sqrt ( ) / 3.0 , -consts:: FRAC_PI_6 ) ,
146
+ ( -1.0 , -consts:: FRAC_PI_4 ) ,
147
+ ( -3.0_f64 . sqrt ( ) , -consts:: FRAC_PI_3 ) ,
150
148
]
151
149
. iter ( )
152
150
{
@@ -167,12 +165,12 @@ mod tests {
167
165
168
166
#[ test]
169
167
fn infinity ( ) {
170
- assert_eq ! ( atan( f64 :: INFINITY ) , f64 :: consts:: FRAC_PI_2 ) ;
168
+ assert_eq ! ( atan( f64 :: INFINITY ) , consts:: FRAC_PI_2 ) ;
171
169
}
172
170
173
171
#[ test]
174
172
fn minus_infinity ( ) {
175
- assert_eq ! ( atan( f64 :: NEG_INFINITY ) , -f64 :: consts:: FRAC_PI_2 ) ;
173
+ assert_eq ! ( atan( f64 :: NEG_INFINITY ) , -consts:: FRAC_PI_2 ) ;
176
174
}
177
175
178
176
#[ test]
0 commit comments