[ODE] M_PI problem

Eric Trousset eTrousset at wanyrobotics.com
Wed Apr 23 06:08:02 2003


This is a multi-part message in MIME format.

------_=_NextPart_001_01C30999.290A5630
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

It is because 35 and 180 are integers, so M_PI is casted into an int =
before the * occurs...
you should try 35.0f / 180.0f * M_PI, the result will be a float
=20
-----Message d'origine-----
De : Koby Zalmanson [mailto:zkoby@inter.net.il]
Envoy=E9 : dimanche 20 avril 2003 17:23
=C0 : ode@q12.org
Objet : [ODE] M_PI problem


When I tried to use M_PI in some of the calculations of an angle the =
calculation was  0 for example: 35/180*M_PI
do you know why?

------_=_NextPart_001_01C30999.290A5630
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40" xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office" xmlns:w =3D=20
"urn:schemas-microsoft-com:office:word"><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3DWord.Document name=3DProgId>
<META content=3D"MSHTML 6.00.2800.1141" name=3DGENERATOR>
<META content=3D"Microsoft Word 10" name=3DOriginator><LINK=20
href=3D"cid:filelist.xml@01C30761.762404C0" rel=3DFile-List><!--[if gte =
mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:ApplyBreakingRules/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<STYLE>@font-face {
	font-family: SimSun;
}
@font-face {
	font-family: @SimSun;
}
@page Section1 {size: 595.3pt 841.9pt; margin: 72.0pt 90.0pt 72.0pt =
90.0pt; mso-header-margin: 35.4pt; mso-footer-margin: 35.4pt; =
mso-paper-source: 0; mso-gutter-direction: rtl; }
P.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; DIRECTION: rtl; FONT-FAMILY: =
"Times New Roman"; unicode-bidi: embed; TEXT-ALIGN: right; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: SimSun
}
LI.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; DIRECTION: rtl; FONT-FAMILY: =
"Times New Roman"; unicode-bidi: embed; TEXT-ALIGN: right; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: SimSun
}
DIV.MsoNormal {
	FONT-SIZE: 12pt; MARGIN: 0cm 0cm 0pt; DIRECTION: rtl; FONT-FAMILY: =
"Times New Roman"; unicode-bidi: embed; TEXT-ALIGN: right; =
mso-style-parent: ""; mso-pagination: widow-orphan; =
mso-fareast-font-family: SimSun
}
A:link {
	COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlink {
	COLOR: blue; TEXT-DECORATION: underline; text-underline: single
}
A:visited {
	COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.MsoHyperlinkFollowed {
	COLOR: purple; TEXT-DECORATION: underline; text-underline: single
}
SPAN.EmailStyle17 {
	COLOR: windowtext; FONT-FAMILY: Arial; mso-style-type: =
personal-compose; mso-style-noshow: yes; mso-ansi-font-size: 10.0pt; =
mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; =
mso-hansi-font-family: Arial; mso-bidi-font-family: Arial
}
SPAN.SpellE {
	mso-style-name: ""; mso-spl-e: yes
}
SPAN.GramE {
	mso-style-name: ""; mso-gram-e: yes
}
DIV.Section1 {
	page: Section1
}
</STYLE>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:"\05D8\05D1\05DC\05D4 \05E8\05D2\05D9\05DC\05D4";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=3DEN-US style=3D"tab-interval: 36.0pt" vLink=3Dpurple =
link=3Dblue>
<DIV><SPAN class=3D383400413-23042003><FONT face=3DArial color=3D#0000ff =
size=3D2>It is=20
because 35 and 180 are integers, so M_PI is casted into an int before =
the *=20
occurs...</FONT></SPAN></DIV>
<DIV><SPAN class=3D383400413-23042003><FONT face=3DArial color=3D#0000ff =
size=3D2>you=20
should try 35.0f / 180.0f * M_PI, the result will be a =
float</FONT></SPAN></DIV>
<DIV><SPAN class=3D383400413-23042003><FONT face=3DArial color=3D#0000ff =

size=3D2></FONT></SPAN>&nbsp;</DIV>
<BLOCKQUOTE dir=3Drtl=20
style=3D"PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px =
solid">
  <DIV class=3DOutlookMessageHeader dir=3Dltr align=3Dleft><FONT =
face=3DTahoma=20
  size=3D2>-----Message d'origine-----<BR><B>De&nbsp;:</B> Koby =
Zalmanson=20
  [mailto:zkoby@inter.net.il]<BR><B>Envoy=E9&nbsp;:</B> dimanche 20 =
avril 2003=20
  17:23<BR><B>=C0&nbsp;:</B> ode@q12.org<BR><B>Objet&nbsp;:</B> [ODE] =
M_PI=20
  problem<BR><BR></FONT></DIV>
  <DIV class=3DSection1 dir=3Drtl>
  <P class=3DMsoNormal dir=3Drtl><FONT face=3DArial size=3D2><SPAN =
dir=3Dltr=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">When I tried to use M_PI =
in some=20
  of the calculations of an angle the calculation <SPAN =
class=3DGramE>was <SPAN=20
  style=3D"mso-spacerun: yes">&nbsp;</SPAN>0</SPAN> for example: =
<B><SPAN=20
  style=3D"FONT-WEIGHT: =
bold">35/180</SPAN></B>*M_PI<o:p></o:p></SPAN></FONT></P>
  <P class=3DMsoNormal dir=3Drtl><FONT face=3DArial size=3D2><SPAN =
dir=3Dltr=20
  style=3D"FONT-SIZE: 10pt; FONT-FAMILY: Arial">do you know=20
  why?<o:p></o:p></SPAN></FONT></P></DIV></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C30999.290A5630--