How to round a float or double to 2 decimal places? 
	 
	
		| Author | 
		Message | 
	 
		 
		illzidaneyou
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 12, 2010 6:34 pm    Post subject: How to round a float or double to 2 decimal places?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				What is the code for rounding a float or double to 2 decimal places?
 
 
The only rounding code I know is Math.round() but this only rounds to the nearest 0.5
 
 
Please let there be a code!
 
 
Any help is appreciated. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
		 
		Sponsor Sponsor 
		 
  
		 | 
		
 | 
	 
	 
		  | 
	 
				 
		jbking
 
 
 
    
		 | 
		
		
			
				  Posted: Tue Jan 12, 2010 6:55 pm    Post subject: Re: How to round a float or double to 2 decimal places?  | 
	
				
				 | 
			 
			 
				
  | 
			 
			
				| Sun's forums has a thread about this already. | 
			 
			
				 | 
			 
		  | 
	 
	 
		 | 
		
		 | 
	 
	  
		  | 
	 
				 
		 | 
	 
 
	
	
	 
	
	 |