c# - Rounding to 3 decimal places in a distance formula -


i have double need rounded 3 decimal places. i'm not sure how accurately implement math.round. have far:

double distance= math.sqrt(deltax + deltay); math.round((decimal)distance, 3); console.writeline("distance :" + distance); 

use return value of math.round (already noted uwe keim) , remove decimal cast.

double distance = math.sqrt(10.438295 + 10.4384534295); console.writeline("distance :" + math.round(distance, 3)); 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -