<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Apple Color Emoji";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.E-MailFormatvorlage19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style></head><body lang=DE-CH link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Okay, taking your comment into account, we could use the formula</span><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'> c := (r * 2521 + 1455) DIV 2911; (INTEGER arithmetic)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>The error 2521/2911 – sqrt(3)/2 = 1.7 x10^-8. That’s smaller than the machine epsilon of Oberon REALs </span><span lang=EN-US style='font-family:"Apple Color Emoji";mso-fareast-language:EN-US'>☺</span><span lang=EN-US style='mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>br<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Jörg<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span style='font-size:12.0pt;color:black'>Von: </span></b><span style='font-size:12.0pt;color:black'>Oberon <oberon-bounces@lists.inf.ethz.ch> im Auftrag von "John R. Strohm" <strohm@airmail.net><br><b>Antworten an: </b>ETH Oberon and related systems <oberon@lists.inf.ethz.ch><br><b>Datum: </b>Mittwoch, 20. Februar 2019 um 15:20<br><b>An: </b>ETH Oberon and related systems <oberon@lists.inf.ethz.ch><br><b>Cc: </b><oberon@lists.inf.ethz.ch><br><b>Betreff: </b>Re: [Oberon] Oberon-7 - Circle Segments<o:p></o:p></span></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Looks like a first-order Taylor series expansion.<br><br>The assumption is that you are underflowing on the second term.<o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>From a signal processing point-of-view, you are generally better off calculating to the maximum precision you have available, including the (appropriately-scaled) rounding, and THEN truncating down to your final desired range.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Also, division is usually frowned upon in DSP work, because DSP chips don't usually have hardware dividers. They do have single-cycle hardware multipliers.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>--John<o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><br>--- joerg.straube@iaeth.ch wrote:<br><br>From: Jörg <joerg.straube@iaeth.ch><br>To: ETH Oberon and related systems <oberon@lists.inf.ethz.ch><br>Subject: Re: [Oberon] Oberon-7 - Circle Segments<br>Date: Wed, 20 Feb 2019 13:37:01 +0100<o:p></o:p></span></p><div><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>Tomas</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'> </span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>Just for completeness: </span><span lang=EN-US style='font-size:10.0pt;font-family:"Apple Color Emoji"'>☺</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>The formula c := (r * 181 + 104) DIV 209; [now with correct rounding] calculates the HourTicks absolutely correctly for all circles with radius “r” up to 780 pixels.</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>The formula c := (r * 71 + 41) DIV 82; is correct for circles with radius “r” up to 140 pixels. For larger circles it’s good as well, but sometimes off by one pixel.</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'> </span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>br</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'>Jörg</span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p><p><span lang=EN-US style='font-size:10.0pt;font-family:"Arial",sans-serif'> </span><span style='font-size:10.0pt;font-family:"Arial",sans-serif'><o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>-- <a href="file:////eonapps/ft/wm/page/compose%3fsend_to=Oberon%2540lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems <a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon">https://lists.inf.ethz.ch/mailman/listinfo/oberon</a> <o:p></o:p></span></p></div></div><p class=MsoNormal>-- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon <o:p></o:p></p></div></body></html>