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
Post a Comment