<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - cairo_rotate inherently inaccurate"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=89071">89071</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cairo_rotate inherently inaccurate
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>cairo
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>general
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>chris@chris-wilson.co.uk
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>terra@gnome.org
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>cairo-bugs@cairographics.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>cairo_rotate takes its argument in radians which is one of those
things that work better on a blackboard than on a computer.

Consider the angle M_PI/2.  When this angle is rounded to its closest
"double" representative x, we have sin(x)=1 [good!] but cos(x)=6.12323e-17
[not good].

This is an API problem: the damage is already done when cairo_rotate
is entered.

Suggestions:

1. Add cairo_rotate_degrees and/or cairo_rotate_pi, the latter taking
   an angle argument that is 2 for a full rotation.

2. Make the backend api use an angle argument that is 2 for a full turn.

3. Use the IEEE 754-2008 functions sinpi and cospi in the backends
   where they currently use sin and cos.

   <a href="http://www.math.fsu.edu/~gallivan/courses/FCM1/IEEE-fpstandard-2008.pdf.gz">http://www.math.fsu.edu/~gallivan/courses/FCM1/IEEE-fpstandard-2008.pdf.gz</a>

   The sinpi and cospi functions are fairly easy to implement.  Feel free
   to grab code from
<a href="https://git.gnome.org/browse/goffice/tree/goffice/math/go-math.c">https://git.gnome.org/browse/goffice/tree/goffice/math/go-math.c</a>
   lines 942-1043 which also has tanpi and atan2pi.

Benefits: the matrices will actually have zeros where you would expect them.
Rotating by 90 degrees four times will actually bring you back where you
started.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>