A float minus an integer returns a weird result
              in 
             Programming Questions 
              •  
              2 months ago    
            
 
           
              Given the following code:
             
             - float rate=1.7;
 - int intrate=int(rate);
 - print(intrate); // >> 1 >> thats ok
 - print(rate-intrate); // >> 0.700005 >> wtf?
 
              Could somebody please explain to me why `intrate` prints as 0.700005 instead of just 0.7 and how to correct it?
             
            
             Thanks a lot.
            
 
            
              
              1  
            
 
            