Skip to content

Instantly share code, notes, and snippets.

@jimfleming
Created May 26, 2010 19:35
Show Gist options
  • Save jimfleming/414941 to your computer and use it in GitHub Desktop.
Save jimfleming/414941 to your computer and use it in GitHub Desktop.
Calculates the difference between two dollar values with close approximation.
function calculate_savings(cost, sale) {
cost *= 100;
sale *= 100;
return ((cost - sale) / 100).toFixed(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment