<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Rounding numbers]]></title><description><![CDATA[<p dir="auto">I'd expect this code to produce 2.33 but it gives me 2.33999999999 - is this a JavaScript thing or a HISE thing? Thanks.</p>
<pre><code>Console.print(Math.round(2.337898 * 100) / 100);
</code></pre>
]]></description><link>https://forum.hise.audio/topic/50/rounding-numbers</link><generator>RSS for Node</generator><lastBuildDate>Sat, 11 Jul 2026 05:37:50 GMT</lastBuildDate><atom:link href="https://forum.hise.audio/topic/50.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 09 Oct 2016 19:48:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Rounding numbers on Mon, 10 Oct 2016 13:44:53 GMT]]></title><description><![CDATA[<p dir="auto">Fantastic!</p>
]]></description><link>https://forum.hise.audio/post/260</link><guid isPermaLink="true">https://forum.hise.audio/post/260</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Mon, 10 Oct 2016 13:44:53 GMT</pubDate></item><item><title><![CDATA[Reply to Rounding numbers on Tue, 11 Oct 2016 19:43:44 GMT]]></title><description><![CDATA[<p dir="auto"><code>Engine.doubleToString(number, digits)?</code></p>
]]></description><link>https://forum.hise.audio/post/259</link><guid isPermaLink="true">https://forum.hise.audio/post/259</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Tue, 11 Oct 2016 19:43:44 GMT</pubDate></item><item><title><![CDATA[Reply to Rounding numbers on Mon, 10 Oct 2016 11:09:49 GMT]]></title><description><![CDATA[<p dir="auto">Ah I see, there might be another solution then - I'm using custom knob and slider graphics on my interface and I want to display the current value of those knobs in separate labels so I'm using knob.getValue(). But for things like the ADSR sustain which is in dB I don't get the nice neat -100 - 0 dB readout like the default knob provides (when set to Decibels mode). Is there a command to retrieve a knob's display value rather than its actual value?</p>
<p dir="auto">Edit: Actually math.floor works fine for the sustain parameter. For a pitch constant modulator though I need more precision than an integer so I used```<br />
Console.print(Math.floor(2.337898 * 100) / 100);</p>
<pre><code class="language-but"></code></pre>
]]></description><link>https://forum.hise.audio/post/258</link><guid isPermaLink="true">https://forum.hise.audio/post/258</guid><dc:creator><![CDATA[David Healey]]></dc:creator><pubDate>Mon, 10 Oct 2016 11:09:49 GMT</pubDate></item><item><title><![CDATA[Reply to Rounding numbers on Sun, 09 Oct 2016 23:49:04 GMT]]></title><description><![CDATA[<p dir="auto">Nope, that's standard double floating point behaviour (you don't have exact numbers but more like a guarantee how many digits are precise). But unless you are planning to simulate a scientific environment, it should not affect your functionality <img src="%7BSMILIES_PATH%7D/icon_e_smile.gif" alt=":)" title="Smile" class=" img-fluid img-markdown" /></p>
<p dir="auto">If you want 2.33, use Math.floor() instead (it still gives you the rounding error tough).</p>
]]></description><link>https://forum.hise.audio/post/255</link><guid isPermaLink="true">https://forum.hise.audio/post/255</guid><dc:creator><![CDATA[Christoph Hart]]></dc:creator><pubDate>Sun, 09 Oct 2016 23:49:04 GMT</pubDate></item></channel></rss>