<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Problem with sin cosine</title>
		<link>http://www.allegro.cc/forums/view/590290</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Fri, 09 Mar 2007 15:34:03 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Howdy,</p><p>     I read the post about &quot;how to make an object move in the direction its pointing&quot; and clicked on the link the directed me to an article about this kind of stuff becuase I also had that problem. So I read the article and noticed that I could pass a radian to the &quot;sin()&quot; and &quot;cos()&quot; functions, than multiply the return by the length of the velocity vector. But in order to make this work for me, I had to first convert the allegro degrees (256) of my object into normal degrees (360), than find the radian of the result and pass the final result to the two functions. This worked, but as I read further on, I noticed that &quot;fsin()&quot; and &quot;fcos()&quot; accepted allegro degrees as their parameters, I tried this and it didn&#39;t work.....any suggestions?:-/
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Tue, 27 Feb 2007 08:51:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I tried this and it didn&#39;t work.....any suggestions?:-/
</p></div></div><p>
Yes actually, I suggest you post a small (ie &lt;15 lines) bit of code that demonstrates your problem.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Tue, 27 Feb 2007 08:56:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
but as I read further on, I noticed that &quot;fsin()&quot; and &quot;fcos()&quot; accepted allegro degrees as their parameters, I tried this and it didn&#39;t work.....any suggestions?
</p></div></div><p>


What do you mean by &quot;didn&#39;t work?&quot; And were you actually using the correct function names, which are <tt>fixsin()</tt> and <tt>fixcos()</tt>? <a href="http://www.allegro.cc/manual/api/fixed-point-math-routines/fixed-point-trig/fixsin">Here&#39;s</a> the manual entry for <tt>fixsin()</tt> so you can see how it should be used.</p><p>By the way, for modern computers with fast FPUs, using the fixed versions may actually be slower than their floating point counterparts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (LennyLen)</author>
		<pubDate>Tue, 27 Feb 2007 08:59:56 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Well, the article said the &quot;fsin()&quot; and &quot;fcos()&quot; are the function names. I compile with no errors but when I run the program some super - duper - oober high number is produced. Also, when I try to declare the angle as &quot;fixed&quot; my compiler returns an error that says &quot;fixed&quot; is invalid and doesn&#39;t work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Tue, 27 Feb 2007 09:50:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>

<a href="http://www.allegro.cc/manual/fixed" target="_blank"><span class="a">fixed</span></a> f <span class="k3">=</span> fsin<span class="k2">(</span> <a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span> <span class="n">192</span> <span class="k2">)</span> <span class="k2">)</span><span class="k2">;</span> <span class="c">// 192 is 270 degress</span>
</pre></div></div><p>
IIRC
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Tue, 27 Feb 2007 09:55:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I tried to pass the angle variable in the &quot;fcos()&quot; and &quot;fsin()&quot; functions using itofix but that didn&#39;t work either....help please!.....
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Tue, 27 Feb 2007 10:07:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Show some friggin code!
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Tue, 27 Feb 2007 10:10:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre> <span class="k1">int</span> shipangle<span class="k2">;</span>
<span class="k1">int</span> laserxspeed<span class="k2">;</span>
<span class="k1">int</span> laseryspeed<span class="k2">;</span>
<span class="k1">int</span> laserx,lasery<span class="k2">;</span>

<span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_LEFT<span class="k2">]</span><span class="k2">)</span>
     shipangle<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_RIGHT<span class="k2">]</span><span class="k2">)</span>
     shipangle--<span class="k2">;</span>

laserxspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> fcos<span class="k2">(</span><a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
laseryspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> fsin<span class="k2">(</span><a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>

laserx <span class="k3">+</span><span class="k3">=</span> laserxspeed<span class="k2">;</span>
lasery <span class="k3">+</span><span class="k3">=</span> laseryspeed<span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Tue, 27 Feb 2007 10:44:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="source-code snippet"><div class="inner"><pre>laserxspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> <a href="http://www.allegro.cc/manual/fixtof" target="_blank"><span class="a">fixtof</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
laseryspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> <a href="http://www.allegro.cc/manual/fixtof" target="_blank"><span class="a">fixtof</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/itofix" target="_blank"><span class="a">itofix</span></a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
you have to convert fix back to float/int.</p><p>alternatively you can just use cos/sin from the standard math library...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Tue, 27 Feb 2007 10:48:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I had to first convert the allegro degrees (256) of my object into normal degrees (360), than find the radian of the result
</p></div></div><p>
... why not just convert directly between Allegro degrees and radians (* π / 128)? <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /></p><p>Of course, the best course of action is to keep everything in radians and only convert when drawing (* 128 / π). It&#39;s by far the easiest, most convenient and readable way. And for Eris&#39;s sake, use floats!</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="p">#include &lt;math.h&gt;</span></td></tr><tr><td class="number">2</td><td><span class="p">#include &lt;allegro.h&gt;</span></td></tr><tr><td class="number">3</td><td>&#160;</td></tr><tr><td class="number">4</td><td><span class="k1">float</span> shipangle<span class="k2">;</span></td></tr><tr><td class="number">5</td><td><span class="k1">float</span> laserxspeed, laseryspeed<span class="k2">;</span></td></tr><tr><td class="number">6</td><td><span class="k1">float</span> laserx,lasery<span class="k2">;</span></td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td><span class="k1">void</span> your_function<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span></td></tr><tr><td class="number">9</td><td><span class="k2">{</span></td></tr><tr><td class="number">10</td><td> <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_LEFT<span class="k2">]</span><span class="k2">)</span></td></tr><tr><td class="number">11</td><td>     shipangle <span class="k3">+</span><span class="k3">=</span> SOME_PROPER_AMOUNT<span class="k2">;</span></td></tr><tr><td class="number">12</td><td> <span class="k1">if</span><span class="k2">(</span><a href="http://www.allegro.cc/manual/key" target="_blank"><span class="a">key</span></a><span class="k2">[</span>KEY_RIGHT<span class="k2">]</span><span class="k2">)</span></td></tr><tr><td class="number">13</td><td>     shipangle <span class="k3">-</span><span class="k3">=</span> SOME_PROPER_AMOUNT<span class="k2">;</span></td></tr><tr><td class="number">14</td><td>&#160;</td></tr><tr><td class="number">15</td><td> laserxspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_113.html" target="_blank">cos</a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">16</td><td> laseryspeed <span class="k3">=</span> <span class="n">8</span> <span class="k3">*</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_728.html" target="_blank">sin</a><span class="k2">(</span>shipangle<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">17</td><td>&#160;</td></tr><tr><td class="number">18</td><td> laserx <span class="k3">+</span><span class="k3">=</span> laserxspeed<span class="k2">;</span></td></tr><tr><td class="number">19</td><td> lasery <span class="k3">+</span><span class="k3">=</span> laseryspeed<span class="k2">;</span></td></tr><tr><td class="number">20</td><td><span class="k2">}</span></td></tr></tbody></table></div></div><p>
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">void</span> and_then_draw_it<span class="k2">(</span><span class="k1">void</span><span class="k2">)</span>
<span class="k2">{</span>
 <a href="http://www.allegro.cc/manual/rotate_sprite" target="_blank"><span class="a">rotate_sprite</span></a><span class="k2">(</span>buffer, shipsprite, shipx, shipy, <a href="http://www.allegro.cc/manual/ftofix" target="_blank"><span class="a">ftofix</span></a><span class="k2">(</span>shipangle<span class="k3">*</span><span class="n">128</span>.<span class="n">0</span><span class="k3">/</span>M_PI<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
<span class="k2">}</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Tue, 27 Feb 2007 12:39:36 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>But if I stick with float point math I have to do conversions everry time I call sin() and cos().
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Wed, 28 Feb 2007 03:43:23 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No. Unless you mean the float-&gt;double conversion in sin() and cos() (they take and return doubles), but even the overly anal language of C++ does that automagically without complaining. <img src="http://www.allegro.cc/forums/smileys/tongue.gif" alt=":P" /><br />(And, of course, using doubles is always an option as well)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Wed, 28 Feb 2007 03:49:29 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">gnolam said:</div><div class="quote"><p>
sin() and cos() (they take and return doubles)
</p></div></div><p>

No. Sin() and cos() both take radians, not doubles. (unless you meen the radian AS the double) And how come when I declare a variable with &quot;fixed&quot; my compiler returns an error saying that &quot;fixed&quot; isn&#39;t a class and doesn&#39;t exist?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Wed, 28 Feb 2007 09:04:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
(unless you meen the radian AS the double)
</p></div></div><p>
Yes, he meant radians as doubles. radians are a unit of measure, doubles are an encoding of numeric quantity, they are independant of each other. It would be like saying &quot;im going to measure this in meters, not integers&quot;.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
And how come when I declare a variable with &quot;fixed&quot; my compiler returns an error saying that &quot;fixed&quot; isn&#39;t a class and doesn&#39;t exist?
</p></div></div><p>
I forget exactly what causes this, are you including &lt;allegro.h&gt; before you use a fixed variable?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (kazzmir)</author>
		<pubDate>Wed, 28 Feb 2007 09:18:18 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Dont use fixed numbers, they&#39;re slower than just using doubles and only have a precision from ~-32000 to ~32000 -- just use itofix and ftofix when you need to pass them into allegro functions...</p><p>Also as kazzmir said, radians, degrees, and allegro degrees are just units of measure.  You can put radians into a double, a float or a fixed, just as well as you can put allegro degrees, or degrees, or meters, miles, or light years in.</p><p>A radian is a number between 0 and ~6.2831 (PI*2), a degree is between 0 and 360, and an allegro degree is between 0 and 255 -- they&#39;re all the same and you can use basic fractional math to convert between them.</p><p>For simplicity sake, you could do the following after including math.h (and make sure you include math.h or cos/sin won&#39;t work right):
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;math.h&gt;</span>
<span class="p">#define DegToRad   PI/180.0f</span>
<span class="p">#define RadToDeg   180.0f/PI</span>
</pre></div></div><p>
then when you have a variable:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">double</span> myvar <span class="k3">=</span> <span class="n">180</span><span class="k2">;</span>  <span class="c">//180 degrees</span>
<span class="k1">double</span> length <span class="k3">=</span> <span class="n">10</span><span class="k2">;</span>  <span class="c">//10 pixels</span>
</pre></div></div><p>
and you need to pass it into cos or sin you can:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">//the double "myvar" is in degrees, but cos and sin only take doubles as radians!</span>
<span class="k1">double</span> dx <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_113.html" target="_blank">cos</a><span class="k2">(</span>myvar <span class="k3">*</span> DegToRad<span class="k2">)</span> <span class="k3">*</span> length<span class="k2">;</span>
<span class="k1">double</span> dy <span class="k3">=</span> <a href="http://www.delorie.com/djgpp/doc/libc/libc_728.html" target="_blank">sin</a><span class="k2">(</span>myvar <span class="k3">*</span> DegToRad<span class="k2">)</span> <span class="k3">*</span> length<span class="k2">;</span>
</pre></div></div><p>

<img src="http://www.allegro.cc/forums/smileys/cool.gif" alt="8-)" /></p><p>edit:<br />To convert from degrees to allegro degrees:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define DegToADeg   256.0f/360.0f</span>
<span class="p">#define ADegToDeg   360.0f/256.0f</span>
</pre></div></div><p>
And Similarly to convert allegro degrees to radians:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define ADegToRad   PI/128.0f</span>
<span class="p">#define RadToADeg   128.0f/PI</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Wed, 28 Feb 2007 09:55:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ah,ha! Thanks. That&#39;s what I was looking for. A simply and fast way to convert....thanks. (Can&#39;t believe I didn&#39;t think of that);)
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (blargmob)</author>
		<pubDate>Wed, 28 Feb 2007 11:02:13 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>On the radians / double issue again:<br />Computers don&#39;t know about units (meters, degrees, liters, ampères, kelvins, radians and what have you) when doing calculations; all units are usually implicit, and the function takes something as an argument or returns something that is to be interpreted as a real-world number, the documentation usually specifies what unit is expected. For many things, especially in the computing world, there are conventions that pretty much everybody adheres to: for example, the size of a data chunk is given in bytes (not 12-bit binary words, or words of 57 base-7 digits). For other types of quantities though, such as angles, the matter isn&#39;t as clear, since there are several systems being used alongside each other; in this case, there are 3 systems involved, each of which has its advantages:<br />- Degrees; a full circle equals 360 degrees. This format is very human-friendly, since most commonly used angles are represented as whole numbers (0, 30, 45, 90, 180). It also allows for easy conversion to and from the &quot;clock&quot; system (the system used by sailors and aircraft pilots to indicate relative directions: &quot;Enemy fighters at 3 o&#39;clock!&quot;) - each hour equals 30 degrees. OpenGL uses this format.<br />- Radians; a full circle equals 2 * PI. From the mathematician&#39;s point of view, this is the &quot;natural&quot; way of measuring angles, because it defines the angle by the length of an arc on the unit circle. In other words, an angle in radians equals the length of its arc divided by a radius. (It makes more sense when you see it sketched on paper). Also, all the trig functions can be used unchanged for various circle calculations when using radians. Downside is that angles in this format look very un-intuitive, because PI is not a whole number. The C math library (libm) uses radians.<br />- Allegro degrees; a full circle equals 256. Big advantage is that it allows for a number of speed optimizations, especially on older computers. Wrapping an angle into a full-circle-range, which usually requires a modulo operation, can be optimized to a bitwise-and, because 256 is a power-of-2. It is still quite intuitive (half circle is 128, 1/4 is 64, etc.); downside, though, is that it is incompatible with pretty much all other libraries, including libm.</p><p>The unit chosen is independent from the numeric encoding format you use: int, allegro::fixed, float, double, etc.<br />The issue with allegro&#39;s math functions is that they expect fixed-point numbers, but since they are typedef&#39;ed as long ints, C cannot tell the difference, nor convert them correctly for you.</p><p>My suggestion is to leave the fixed-point math alone altogether, and do everything using floats (or doubles) and radians. The only point where you really can&#39;t avoid 256-based fixed-point values is when you pass angles to allegro&#39;s drawing functions, in which case you should just take the float-point value and convert it on-the-fly, like this:
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#include &lt;allegro.h&gt;</span>
<span class="p">#include &lt;math.h&gt;</span>
<span class="c">// assuming angle to be a float:</span>
<a href="http://www.allegro.cc/manual/rotate_sprite" target="_blank"><span class="a">rotate_sprite</span></a><span class="k2">(</span><a href="http://www.allegro.cc/manual/screen" target="_blank"><span class="a">screen</span></a>, sprite, <span class="n">100</span>, <span class="n">100</span>, <a href="http://www.allegro.cc/manual/ftofix" target="_blank"><span class="a">ftofix</span></a><span class="k2">(</span>angle <span class="k3">*</span> <span class="n">128</span>.<span class="n">0f</span> <span class="k3">/</span> M_PI<span class="k2">)</span><span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Wed, 28 Feb 2007 17:14:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
#define DegToADeg   256/360<br />#define ADegToDeg   360/256
</p></div></div><p>

Baaaaaaaad idea. 256/360 is an integer division, resulting in an integer. You want 256.0/360.0 or something similar.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
&quot;Enemy fighters at 3 o&#39;clock!&quot;) - each hour equals 15 degrees.
</p></div></div><p>

Don&#39;t you mean 30 degrees?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (X-G)</author>
		<pubDate>Wed, 28 Feb 2007 17:17:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>&#39;course. 30 degrees. I&#39;ll go edit, hehe.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Wed, 28 Feb 2007 17:22:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Baaaaaaaad idea. 256/360 is an integer division, resulting in an integer. You want 256.0/360.0 or something similar.
</p></div></div><p>
Thank you, I&#39;ll edit that post and put 256.0f/360.0f -- etc, I&#39;ve been using VB.NET where constants have to be declared with data types and this would work fine, and I&#39;ve forgotten about some the annoyances of C...
</p><div class="source-code snippet"><div class="inner"><pre>Public Const DegreesToADegrees As Double <span class="k3">=</span> <span class="n">256</span> <span class="k3">/</span> <span class="n">360</span>
</pre></div></div><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Sat, 03 Mar 2007 12:31:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Even 256/360.0f would do. But, even that looks like horrible coding style to me (DegToADeg sounds like a function, not a constant, which should be const float blah = blah anyway <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />). I&#39;d personally do #define DegToADeg(x) = (x) * 256/360.0f.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sun, 04 Mar 2007 05:06:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
#define DegToADeg(x) = (x) * 256/360.0f.
</p></div></div><p>
What about:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">const</span> <span class="k1">float</span> DEG2ADEG_FAC <span class="k3">=</span> <span class="n">256</span>.<span class="n">0f</span> <span class="k3">/</span> <span class="n">360</span>.<span class="n">0f</span><span class="k2">;</span>
<span class="k1">inline</span> <span class="k1">float</span> DegToADeg<span class="k2">(</span><span class="k1">float</span> x<span class="k2">)</span> <span class="k2">{</span> <span class="k1">return</span> x <span class="k3">*</span> DEG2ADEG_FAC<span class="k2">;</span> <span class="k2">}</span>
</pre></div></div><p>
?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Tobias Dammers)</author>
		<pubDate>Sun, 04 Mar 2007 22:45:41 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s even better.</p><p>[edit]<br />Nevermind
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (BAF)</author>
		<pubDate>Sun, 04 Mar 2007 22:48:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Baf said:</div><div class="quote"><p>

I&#39;d personally do #define DegToADeg(x) = (x) * 256/360.0f.
</p></div></div><p>
</p><div class="source-code snippet"><div class="inner"><pre><span class="p">#define DegToADeg(x) = (x) * (256/360.0f)</span>
</pre></div></div><p>
Makes it easier for a compiler to optimize your code.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Mon, 05 Mar 2007 11:04:00 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Some versions of &lt;math.h&gt; define fcos() and fsin() as float versions (rather than double) of sin() and cos()</p><p>This is why Allegro&#39;s fsin() and fcos() have been renamed to fixsin() and fixcos().  It is better to use the new names to avoid confusion (both by you and by your compiler).  The old compatability defines may be removed by Allegro 5.0.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Mon, 05 Mar 2007 19:43:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How evil... when was sinf / cosf finally decided upon?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (ImLeftFooted)</author>
		<pubDate>Mon, 05 Mar 2007 22:33:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>ack, variable names in ALL CAPITALS! how ugly!</p><p>sorry, been sucked into the void of PascalCase, and am very used to it. -- I can tell if it&#39;s a variable, property or function by the icon that appears next to it in my autocomplete, and also get the neat little XML comments to the right of it...</p><p>God I love VB...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michael Jensen)</author>
		<pubDate>Fri, 09 Mar 2007 15:34:03 +0000</pubDate>
	</item>
</rss>
