@@ -398,7 +398,6 @@ mod tests {
398398 extern crate core;
399399
400400 use self :: core:: f64:: consts:: { E , PI } ;
401- use self :: core:: f64:: { EPSILON , INFINITY , MAX , MIN , MIN_POSITIVE , NAN , NEG_INFINITY } ;
402401 use super :: pow;
403402
404403 const POS_ZERO : & [ f64 ] = & [ 0.0 ] ;
@@ -407,15 +406,15 @@ mod tests {
407406 const NEG_ONE : & [ f64 ] = & [ -1.0 ] ;
408407 const POS_FLOATS : & [ f64 ] = & [ 99.0 / 70.0 , E , PI ] ;
409408 const NEG_FLOATS : & [ f64 ] = & [ -99.0 / 70.0 , -E , -PI ] ;
410- const POS_SMALL_FLOATS : & [ f64 ] = & [ ( 1.0 / 2.0 ) , MIN_POSITIVE , EPSILON ] ;
411- const NEG_SMALL_FLOATS : & [ f64 ] = & [ -( 1.0 / 2.0 ) , -MIN_POSITIVE , -EPSILON ] ;
412- const POS_EVENS : & [ f64 ] = & [ 2.0 , 6.0 , 8.0 , 10.0 , 22.0 , 100.0 , MAX ] ;
413- const NEG_EVENS : & [ f64 ] = & [ MIN , -100.0 , -22.0 , -10.0 , -8.0 , -6.0 , -2.0 ] ;
409+ const POS_SMALL_FLOATS : & [ f64 ] = & [ ( 1.0 / 2.0 ) , f64 :: MIN_POSITIVE , f64 :: EPSILON ] ;
410+ const NEG_SMALL_FLOATS : & [ f64 ] = & [ -( 1.0 / 2.0 ) , -f64 :: MIN_POSITIVE , -f64 :: EPSILON ] ;
411+ const POS_EVENS : & [ f64 ] = & [ 2.0 , 6.0 , 8.0 , 10.0 , 22.0 , 100.0 , f64 :: MAX ] ;
412+ const NEG_EVENS : & [ f64 ] = & [ f64 :: MIN , -100.0 , -22.0 , -10.0 , -8.0 , -6.0 , -2.0 ] ;
414413 const POS_ODDS : & [ f64 ] = & [ 3.0 , 7.0 ] ;
415414 const NEG_ODDS : & [ f64 ] = & [ -7.0 , -3.0 ] ;
416- const NANS : & [ f64 ] = & [ NAN ] ;
417- const POS_INF : & [ f64 ] = & [ INFINITY ] ;
418- const NEG_INF : & [ f64 ] = & [ NEG_INFINITY ] ;
415+ const NANS : & [ f64 ] = & [ f64 :: NAN ] ;
416+ const POS_INF : & [ f64 ] = & [ f64 :: INFINITY ] ;
417+ const NEG_INF : & [ f64 ] = & [ f64 :: NEG_INFINITY ] ;
419418
420419 const ALL : & [ & [ f64 ] ] = & [
421420 POS_ZERO ,
@@ -492,83 +491,83 @@ mod tests {
492491 #[ test]
493492 fn nan_inputs ( ) {
494493 // NAN as the base:
495- // (NAN ^ anything *but 0* should be NAN)
496- test_sets_as_exponent ( NAN , & ALL [ 2 ..] , NAN ) ;
494+ // (f64:: NAN ^ anything *but 0* should be f64:: NAN)
495+ test_sets_as_exponent ( f64 :: NAN , & ALL [ 2 ..] , f64 :: NAN ) ;
497496
498- // NAN as the exponent:
499- // (anything *but 1* ^ NAN should be NAN)
500- test_sets_as_base ( & ALL [ ..( ALL . len ( ) - 2 ) ] , NAN , NAN ) ;
497+ // f64:: NAN as the exponent:
498+ // (anything *but 1* ^ f64:: NAN should be f64:: NAN)
499+ test_sets_as_base ( & ALL [ ..( ALL . len ( ) - 2 ) ] , f64 :: NAN , f64 :: NAN ) ;
501500 }
502501
503502 #[ test]
504503 fn infinity_as_base ( ) {
505504 // Positive Infinity as the base:
506- // (+Infinity ^ positive anything but 0 and NAN should be +Infinity)
507- test_sets_as_exponent ( INFINITY , & POS [ 1 ..] , INFINITY ) ;
505+ // (+Infinity ^ positive anything but 0 and f64:: NAN should be +Infinity)
506+ test_sets_as_exponent ( f64 :: INFINITY , & POS [ 1 ..] , f64 :: INFINITY ) ;
508507
509- // (+Infinity ^ negative anything except 0 and NAN should be 0.0)
510- test_sets_as_exponent ( INFINITY , & NEG [ 1 ..] , 0.0 ) ;
508+ // (+Infinity ^ negative anything except 0 and f64:: NAN should be 0.0)
509+ test_sets_as_exponent ( f64 :: INFINITY , & NEG [ 1 ..] , 0.0 ) ;
511510
512511 // Negative Infinity as the base:
513512 // (-Infinity ^ positive odd ints should be -Infinity)
514- test_sets_as_exponent ( NEG_INFINITY , & [ POS_ODDS ] , NEG_INFINITY ) ;
513+ test_sets_as_exponent ( f64 :: NEG_INFINITY , & [ POS_ODDS ] , f64 :: NEG_INFINITY ) ;
515514
516515 // (-Infinity ^ anything but odd ints should be == -0 ^ (-anything))
517516 // We can lump in pos/neg odd ints here because they don't seem to
518517 // cause panics (div by zero) in release mode (I think).
519- test_sets ( ALL , & |v : f64 | pow ( NEG_INFINITY , v) , & |v : f64 | pow ( -0.0 , -v) ) ;
518+ test_sets ( ALL , & |v : f64 | pow ( f64 :: NEG_INFINITY , v) , & |v : f64 | pow ( -0.0 , -v) ) ;
520519 }
521520
522521 #[ test]
523522 fn infinity_as_exponent ( ) {
524523 // Positive/Negative base greater than 1:
525- // (pos/neg > 1 ^ Infinity should be Infinity - note this excludes NAN as the base)
526- test_sets_as_base ( & ALL [ 5 ..( ALL . len ( ) - 2 ) ] , INFINITY , INFINITY ) ;
524+ // (pos/neg > 1 ^ Infinity should be Infinity - note this excludes f64:: NAN as the base)
525+ test_sets_as_base ( & ALL [ 5 ..( ALL . len ( ) - 2 ) ] , f64 :: INFINITY , f64 :: INFINITY ) ;
527526
528527 // (pos/neg > 1 ^ -Infinity should be 0.0)
529- test_sets_as_base ( & ALL [ 5 ..ALL . len ( ) - 2 ] , NEG_INFINITY , 0.0 ) ;
528+ test_sets_as_base ( & ALL [ 5 ..ALL . len ( ) - 2 ] , f64 :: NEG_INFINITY , 0.0 ) ;
530529
531530 // Positive/Negative base less than 1:
532531 let base_below_one = & [ POS_ZERO , NEG_ZERO , NEG_SMALL_FLOATS , POS_SMALL_FLOATS ] ;
533532
534- // (pos/neg < 1 ^ Infinity should be 0.0 - this also excludes NAN as the base)
535- test_sets_as_base ( base_below_one, INFINITY , 0.0 ) ;
533+ // (pos/neg < 1 ^ Infinity should be 0.0 - this also excludes f64:: NAN as the base)
534+ test_sets_as_base ( base_below_one, f64 :: INFINITY , 0.0 ) ;
536535
537536 // (pos/neg < 1 ^ -Infinity should be Infinity)
538- test_sets_as_base ( base_below_one, NEG_INFINITY , INFINITY ) ;
537+ test_sets_as_base ( base_below_one, f64 :: NEG_INFINITY , f64 :: INFINITY ) ;
539538
540539 // Positive/Negative 1 as the base:
541540 // (pos/neg 1 ^ Infinity should be 1)
542- test_sets_as_base ( & [ NEG_ONE , POS_ONE ] , INFINITY , 1.0 ) ;
541+ test_sets_as_base ( & [ NEG_ONE , POS_ONE ] , f64 :: INFINITY , 1.0 ) ;
543542
544543 // (pos/neg 1 ^ -Infinity should be 1)
545- test_sets_as_base ( & [ NEG_ONE , POS_ONE ] , NEG_INFINITY , 1.0 ) ;
544+ test_sets_as_base ( & [ NEG_ONE , POS_ONE ] , f64 :: NEG_INFINITY , 1.0 ) ;
546545 }
547546
548547 #[ test]
549548 fn zero_as_base ( ) {
550549 // Positive Zero as the base:
551- // (+0 ^ anything positive but 0 and NAN should be +0)
550+ // (+0 ^ anything positive but 0 and f64:: NAN should be +0)
552551 test_sets_as_exponent ( 0.0 , & POS [ 1 ..] , 0.0 ) ;
553552
554- // (+0 ^ anything negative but 0 and NAN should be Infinity)
553+ // (+0 ^ anything negative but 0 and f64:: NAN should be Infinity)
555554 // (this should panic because we're dividing by zero)
556- test_sets_as_exponent ( 0.0 , & NEG [ 1 ..] , INFINITY ) ;
555+ test_sets_as_exponent ( 0.0 , & NEG [ 1 ..] , f64 :: INFINITY ) ;
557556
558557 // Negative Zero as the base:
559- // (-0 ^ anything positive but 0, NAN, and odd ints should be +0)
558+ // (-0 ^ anything positive but 0, f64:: NAN, and odd ints should be +0)
560559 test_sets_as_exponent ( -0.0 , & POS [ 3 ..] , 0.0 ) ;
561560
562- // (-0 ^ anything negative but 0, NAN, and odd ints should be Infinity)
561+ // (-0 ^ anything negative but 0, f64:: NAN, and odd ints should be Infinity)
563562 // (should panic because of divide by zero)
564- test_sets_as_exponent ( -0.0 , & NEG [ 3 ..] , INFINITY ) ;
563+ test_sets_as_exponent ( -0.0 , & NEG [ 3 ..] , f64 :: INFINITY ) ;
565564
566565 // (-0 ^ positive odd ints should be -0)
567566 test_sets_as_exponent ( -0.0 , & [ POS_ODDS ] , -0.0 ) ;
568567
569568 // (-0 ^ negative odd ints should be -Infinity)
570569 // (should panic because of divide by zero)
571- test_sets_as_exponent ( -0.0 , & [ NEG_ODDS ] , NEG_INFINITY ) ;
570+ test_sets_as_exponent ( -0.0 , & [ NEG_ODDS ] , f64 :: NEG_INFINITY ) ;
572571 }
573572
574573 #[ test]
@@ -583,21 +582,17 @@ mod tests {
583582
584583 // Factoring -1 out:
585584 // (negative anything ^ integer should be (-1 ^ integer) * (positive anything ^ integer))
586- ( & [ POS_ZERO , NEG_ZERO , POS_ONE , NEG_ONE , POS_EVENS , NEG_EVENS ] ) . iter ( ) . for_each (
587- |int_set| {
588- int_set. iter ( ) . for_each ( |int| {
589- test_sets ( ALL , & |v : f64 | pow ( -v, * int) , & |v : f64 | {
590- pow ( -1.0 , * int) * pow ( v, * int)
591- } ) ;
592- } )
593- } ,
594- ) ;
585+ [ POS_ZERO , NEG_ZERO , POS_ONE , NEG_ONE , POS_EVENS , NEG_EVENS ] . iter ( ) . for_each ( |int_set| {
586+ int_set. iter ( ) . for_each ( |int| {
587+ test_sets ( ALL , & |v : f64 | pow ( -v, * int) , & |v : f64 | pow ( -1.0 , * int) * pow ( v, * int) ) ;
588+ } )
589+ } ) ;
595590
596591 // Negative base (imaginary results):
597592 // (-anything except 0 and Infinity ^ non-integer should be NAN)
598- ( & NEG [ 1 ..( NEG . len ( ) - 1 ) ] ) . iter ( ) . for_each ( |set| {
593+ NEG [ 1 ..( NEG . len ( ) - 1 ) ] . iter ( ) . for_each ( |set| {
599594 set. iter ( ) . for_each ( |val| {
600- test_sets ( & ALL [ 3 ..7 ] , & |v : f64 | pow ( * val, v) , & |_| NAN ) ;
595+ test_sets ( & ALL [ 3 ..7 ] , & |v : f64 | pow ( * val, v) , & |_| f64 :: NAN ) ;
601596 } )
602597 } ) ;
603598 }
0 commit comments