File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -713,4 +713,21 @@ mod mpf {
713713        assert_eq ! ( five. sign( ) ,  Sign :: Positive ) ; 
714714        assert_eq ! ( minus_five. sign( ) ,  Sign :: Negative ) ; 
715715    } 
716+ 
717+     #[ test]  
718+     fn  test_fmt ( )  { 
719+         let  mut  pi:  Mpf  = Mpf :: zero ( ) ; 
720+         assert_eq ! ( format!( "{:?}" ,  pi) ,  "0" ) ; 
721+         assert_eq ! ( format!( "{:?}" ,  -& pi) ,  "0" ) ; 
722+ 
723+         pi. set_from_str ( "3.141592653589" ,  10 ) ; 
724+ 
725+         // From the GNU MP Section 7.4: "The generated string is a fraction, 
726+         // with an implicit radix point immediately to the left of the first 
727+         // digit. The applicable exponent is written through the expptr pointer. 
728+         // For example, the number 3.1416 would be returned as string "31416" 
729+         // and exponent 1." 
730+         assert_eq ! ( format!( "{:?}" ,  pi) ,  "3141592653589e1" ) ; 
731+         assert_eq ! ( format!( "{:?}" ,  -& pi) ,  "-3141592653589e1" ) ; 
732+     } 
716733} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments