<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>round on Curtis Timson</title><link>https://hugo.curtiscode.dev/tags/round/</link><description>Recent content in round on Curtis Timson</description><generator>Hugo -- gohugo.io</generator><language>en-GB</language><lastBuildDate>Fri, 10 Oct 2014 00:00:00 +0000</lastBuildDate><atom:link href="https://hugo.curtiscode.dev/tags/round/index.xml" rel="self" type="application/rss+xml"/><item><title>Round to the nearest decimal</title><link>https://hugo.curtiscode.dev/post/js/round-to-the-nearest-decimal/</link><pubDate>Fri, 10 Oct 2014 00:00:00 +0000</pubDate><guid>https://hugo.curtiscode.dev/post/js/round-to-the-nearest-decimal/</guid><description>If we need round to the nearest whole number, we can use the Math.round() function to return this:
Math.round(1.34234); //returns 1 However what if we need to round to a decimal place? For example 0.5.
The following function can be used to do just that, and the logic itself can be adapted to be used for other languages too (C#, SQL etc).
function roundToMultiple(value, multiple){ var t = (1/multiple); return (Math.</description></item></channel></rss>