title: Microchip XC16 dsp.h defines incorrect value of PI?
body: <p>In the XC16 compiler's DSP routines header (dsp.h) there are these lines:</p>
  
  <pre><code>/* Some constants. */
  #ifndef PI                              /* [ */
  #define PI 3.1415926535897931159979634685441851615905761718750 /* double */
  #endif  /* ] */
  #ifndef SIN_PI_Q                                /* [ */
  #define SIN_PI_Q 0.7071067811865474617150084668537601828575134277343750
                                                  /* sin(PI/4), (double) */
  #endif  /* ] */
  </code></pre>
  
  <p>But, the value of PI is actually (to the same number of decimal places) is:</p>
  
  <pre><code>3.1415926535897932384626433832795028841971693993751
  </code></pre>
  
  <p>The dsp.h-defined value starts to diverge at the 16th decimal place. For double floating point operations, this is borderline significant. For Q15 representations, this is not significant. The value of sin(pi/4) also diverges from the correct value at the 16th decimal place.</p>
  
  <p>Why is Microchip using the incorrect value? Is there some esoteric reason related to computing trig function values, or is this simply a mistake? Or maybe it does not matter?</p>