Example #1
0
        internal static double CosPi(double x)
        {
            long   y0;
            double y1;

            RangeReduction.ReduceByOnes(2.0 * x, out y0, out y1);
            return(RangeReduction.Cos(y0, y1));
        }
Example #2
0
 internal static double TanPi(double x)
 {
     RangeReduction.ReduceByOnes(2.0 * x, out long y0, out double y1);
     if (y0 % 2L == 0L)
     {
         return(Math.Tan(Math.PI / 2.0 * y1));
     }
     else
     {
         return(-1.0 / Math.Tan(Math.PI / 2.0 * y1));
     }
     // Should be possible to do even better, by reducing wrt pi / 4, but this is good enough for now.
 }
Example #3
0
 /// <summary>
 /// Computes the cosine of the given multiple of &#x3C0;.
 /// </summary>
 /// <param name="x">The argument.</param>
 /// <returns>The value of cos(<paramref name="x"/>&#x3C0;).</returns>
 /// <remarks>
 /// <para>For an explanation of why and when to use this function,
 /// see <see cref="SinPi(double)"/>.</para>
 /// </remarks>
 /// <seealso cref="SinPi(double)"/>
 public static double CosPi(double x)
 {
     RangeReduction.ReduceByOnes(2.0 * x, out long y0, out double y1);
     return(RangeReduction.Cos(y0, y1));
 }