C
C#15mo ago
Nomnomfighter

✅ Trying to round a value but there's seemingly no elegant way to do it?

I've tried two versions (seen here: https://paste.ofcode.org/HXfb53WkUWfRCz8mvTpQTg) But the first (more elegant solution) doesn't work and the second seems unnecessarily backwards?
5 Replies
reflectronic
reflectronic15mo ago
you have to do something like (int)Math.Round((double)guessDistance / 10) * 10; guessDistance / 10 does not do what you want. it produces an integer as the result it has already truncated the answer, rounding will not do anything
Nomnomfighter
NomnomfighterOP15mo ago
Oh, so because I want to divide it, it needs to be a decimal/double! !solved
reflectronic
reflectronic15mo ago
$close
MODiX
MODiX15mo ago
Use the /close command to mark a forum thread as answered
Nomnomfighter
NomnomfighterOP15mo ago
thanks
Want results from more Discord servers?
Add your server