Skip to content

Instantly share code, notes, and snippets.

@1lann
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1lann/55bafa9785276434b5e2 to your computer and use it in GitHub Desktop.
Save 1lann/55bafa9785276434b5e2 to your computer and use it in GitHub Desktop.
double myRound(double num, int decimalPlaces) {
int rounded = num * power10Of(decimalPlaces);
return (double)rounded / power10Of(decimalPlaces);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment