<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><span>My mistake<br><br>&gt; Ah.</span><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div id="yiv1898664165"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;"><div><span>&gt; As often happens, as soon as I have pressed "send" and posted the question, the answer pops out.</span></div><div><span>&gt; xb4 = xb4 - xb4 * xb4 * xb4 * 0.166667f;</span></div><div>&gt;<br><span></span></div><div><span>&gt; is replaced by...</span></div><div>&gt; <br><span></span></div><div><span>&gt; xb4 = xb4 - xb4 * xb4 * xb4 * 0.01f;</span></div>
<div>&gt; <br></div><div>&gt; ...and it works.</div><div><br>and then breaks again<br></div><div>&nbsp;</div><div>Gemnotes-0.1alpha: Live music notation for Pure Data<br>http://sharktracks.co.uk/<br></div>  <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight: bold;">From:</span></b> Ed Kelly &lt;morph_2016@yahoo.co.uk&gt;<br> <b><span style="font-weight: bold;">To:</span></b> Mathieu Bouchard &lt;matju@artengine.ca&gt; <br><b><span style="font-weight: bold;">Cc:</span></b> PD List &lt;pd-list@iem.at&gt;; Joe White &lt;joe@rjdj.me&gt;; pddev &lt;pd-dev@iem.at&gt; <br> <b><span style="font-weight: bold;">Sent:</span></b> Saturday, 24 March 2012, 8:47<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [PD-dev] [PD]  Filter design for iPhone<br>
 </font> </div> <br><div id="yiv1898664165"><div><div style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: times new roman,new york,times,serif; font-size: 12pt;">&gt;&gt; I'm anxious to know what limit is reached in the coefficients of the filter that causes the undefined result (NaN).<br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">&gt;<br>&gt;I haven't seen the code, but I just want to make you notice that adding together -Infinity and +Infinity results in a NaN&nbsp;; so does subtracting <br>&gt;two infinities of the same sign.<br>&gt;<br>&gt;So, the NaN might happen when two expressions that are supposed to partially cancel each other, happen to both overflow, in different directions.<br>&gt;<br>&gt;There are various possible causes for NaN, but with formulas that only involve +, - and *, the possibilities
 are a lot more limited.<br><br>Hmmm.<br>I think that's why it
 puzzles me so. Can you see a / anywhere here?<br><br>&nbsp; while (n--) {<br>&nbsp;&nbsp;&nbsp; i1=(*in++);<br>&nbsp;&nbsp;&nbsp; fc1 = (*fc++);<br>&nbsp;&nbsp;&nbsp; res1 = (*res++);<br>&nbsp;&nbsp;&nbsp; q = 1.0f - fc1;<br>&nbsp;&nbsp;&nbsp; p = fc1 + 0.8f * fc1 * q;<br>&nbsp;&nbsp;&nbsp; fcoeff = p + p - 1.0f;<br>&nbsp;&nbsp;&nbsp; q = res1 * (1.0f + 0.5f * q * (1.0f - q + 5.6f * q * q));<br>&nbsp;&nbsp;&nbsp; i1 -= q * xb4;<br>&nbsp;&nbsp;&nbsp; t1 = xb1;<br>&nbsp;&nbsp;&nbsp; xb1 = (i1 + xb0) * p - xb1 * fcoeff;<br>&nbsp;&nbsp;&nbsp; t2 = xb2;<br>&nbsp;&nbsp;&nbsp; xb2 = (xb1 + t1) * p - xb2 * fcoeff;<br>&nbsp;&nbsp;&nbsp; t1 = xb3;<br>&nbsp;&nbsp;&nbsp; xb3 = (xb2 + t2) * p - xb3 * fcoeff;<br>&nbsp;&nbsp;&nbsp; xb4 = (xb3 + t1) * p - xb4 * fcoeff;<br>&nbsp;&nbsp;&nbsp; xb4 = xb4 - xb4 * xb4 * xb4 * 0.166667f;<br>&nbsp;&nbsp;&nbsp; xb0 = i1;<br>&nbsp;&nbsp;&nbsp; *out++ = xb4; <br>&nbsp;}<br><br>No reciprocals, no divisions, just +,-,*.<br>I cannot
 help thinking I must be reaching a "limit" in the calculus sense...<br><br>Ed<br><br><br><br><br> ______________________________________________________________________<br>| Mathieu BOUCHARD ----- téléphone&nbsp;: +1.514.383.3801 ----- Montréal, QC<br><br> </div> </div>  </div></div></div><br>_______________________________________________<br>Pd-dev mailing list<br><a rel="nofollow" ymailto="mailto:Pd-dev@iem.at" target="_blank" href="mailto:Pd-dev@iem.at">Pd-dev@iem.at</a><br><a rel="nofollow" target="_blank" href="http://lists.puredata.info/listinfo/pd-dev">http://lists.puredata.info/listinfo/pd-dev</a><br><br><br> </div> </div>  </div></div></div><br><br> </div> </div>  </div></body></html>