yeah, my patch only works for rational numbers. <br><br>will have a look at the article / method you posted, claude.<br><br><br><br><br><br><br><br><div class="gmail_quote">On Fri, Dec 16, 2011 at 7:49 PM, Claude Heiland-Allen <span dir="ltr">&lt;<a href="mailto:claude@goto10.org">claude@goto10.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 16/12/11 06:51, i go bananas wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
by the way, here is the method i used:<br>
<br>
first, convert the decimal part to a fraction in the form of n/100000<br>
next, find the highest common factor of n and 100000<br>
(using the &#39;division method&#39; like this:<br>
<a href="http://easycalculation.com/what-is-hcf.php" target="_blank">http://easycalculation.com/<u></u>what-is-hcf.php</a> )<br>
<br>
then just divide n and 100000 by that factor.<br>
</blockquote>
<br></div>
I don&#39;t think that method will give happy results for most simple fractions.  Plus it&#39;s useful to get approximations that are simpler or more accurate, like 3 or 22/7 or 355/113 for pi..<br>
<br>
Your patch doesn&#39;t work very well for me:<br>
<br>
input: 1/7<br>
fraction: 2857/20000<br>
input: 8/9<br>
fraction: 11111/12500<br>
input: 7/11<br>
fraction: 15909/25000<br>
input: 11/17<br>
fraction: 4313.67/6666.67<br>
<br>
(input is &quot;$1 $2&quot;--[/], so as accurate as floating point is...)<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
actually, that means it&#39;s accurate to 6 decimal places, i guess.<br>
</blockquote>
<br></div>
There&#39;s a way to get a &quot;simple&quot; fraction like 1/7 instead of 143/1000 or whatever, could be possible to implement in Pd?  (I&#39;ve not tried.)<br>
<br>
[0] <a href="http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/Data-Ratio.html#approxRational" target="_blank">http://hackage.haskell.org/<u></u>packages/archive/base/latest/<u></u>doc/html/src/Data-Ratio.html#<u></u>approxRational</a><br>

<br>
[1] <a href="http://en.wikipedia.org/wiki/Continued_fraction#Best_rational_approximations" target="_blank">http://en.wikipedia.org/wiki/<u></u>Continued_fraction#Best_<u></u>rational_approximations</a><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
well...whatever :D<span class="HOEnZb"><font color="#888888"><br>
</font></span></blockquote><span class="HOEnZb"><font color="#888888">
<br>
<br>
Claude</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
<a href="mailto:Pd-list@iem.at" target="_blank">Pd-list@iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -&gt; <a href="http://lists.puredata.info/listinfo/pd-list" target="_blank">http://lists.puredata.info/<u></u>listinfo/pd-list</a><br>
</div></div></blockquote></div><br>