<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Соотношение чисел]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9540&amp;type=atom" />
	<updated>2014-04-27T13:08:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9540</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82339#p82339" />
			<content type="html"><![CDATA[<p>Да, что-то я упустил, после сокращения дроби на НОД числа будут взаимно простые, и <strong>while</strong> не нужен.</p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-04-27T13:08:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82339#p82339</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82338#p82338" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Irbis пишет:</cite><blockquote><p>Если я правильно понял задачу:<br /></p><div class="codebox"><pre><code>a := 1920, b := 1080

While (N:=Nod(a,b)) &lt;&gt; 1
   a //=N, b//=N
MsgBox % a . &quot; / &quot; . b
Return

Nod(a,b)
{
  Return !b ? a : Nod(b, mod(a,b))
}
</code></pre></div></blockquote></div><p>Не совсем понятно, зачем здесь<br /></p><div class="codebox"><pre><code>While (N:=Nod(a,b)) &lt;&gt; 1
   a //=N, b//=N</code></pre></div><p>??<br /></p><div class="codebox"><pre><code>a := 3, b := 7
nod := Nod(a,b)
MsgBox, % a//nod . &quot;/&quot; . b//nod

Nod(a,b)
{
  Return !b ? a : Nod(b, mod(a,b))
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-04-27T12:07:24Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82338#p82338</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82331#p82331" />
			<content type="html"><![CDATA[<p>Не за что, тем более что я просто взял практически готовый алгоритм на СРР и перенес на АНК <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-04-26T23:05:32Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82331#p82331</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82329#p82329" />
			<content type="html"><![CDATA[<p>Нет правда, отличный урок с рекурсией, спасибо. Я бы не придумал.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-26T21:42:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82329#p82329</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82328#p82328" />
			<content type="html"><![CDATA[<p><strong>Irbis</strong><br />ШиКаРно! 5+</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-26T21:08:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82328#p82328</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82327#p82327" />
			<content type="html"><![CDATA[<p>Если я правильно понял задачу:<br /></p><div class="codebox"><pre><code>a := 1920, b := 1080

While (N:=Nod(a,b)) &lt;&gt; 1
   a //=N, b//=N
MsgBox % a . &quot; / &quot; . b
Return

Nod(a,b)
{
  Return !b ? a : Nod(b, mod(a,b))
}
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Irbis]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27384</uri>
			</author>
			<updated>2014-04-26T19:54:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82327#p82327</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82326#p82326" />
			<content type="html"><![CDATA[<p>А нет, что то не то:<br /></p><div class="codebox"><pre><code> 
w = 720  
h = 1280
</code></pre></div><p>4 / 8 ???</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-26T19:53:14Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82326#p82326</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82325#p82325" />
			<content type="html"><![CDATA[<p>Вроде дошло <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>
w = 1280
h = 720
 
a := mod(w, h)

While a
    b := a, a := mod(w, a)  
While b
    c := b, b := mod(h, b)  
MsgBox %  w // c &quot; / &quot; h // c
</code></pre></div><p>Хотя может есть способ проще...</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-26T19:50:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82325#p82325</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Соотношение чисел]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=82323#p82323" />
			<content type="html"><![CDATA[<p>Видимо моск отказывает, но как получить соотношение чисел не соображу.<br />Например:<br /></p><div class="codebox"><pre><code>
w = 640
h = 480

***

ratio = 4 / 3
MsgBox % ratio
</code></pre></div><p>640 к 480 относится также как 4 к 3, ну Вы меня поняли <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>То есть суть: найти общий делитель.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2014-04-26T19:00:23Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=82323#p82323</id>
		</entry>
</feed>
