Example #1
0
        }         // 77.30 ns

        private static tComplex tanh1(tComplex value)
        {
            double r2  = value.real * 2;
            double i2  = value.imag * 2;
            double den = System.Math.Cosh(r2) + System.Math.Cos(i2);

            return(new tComplex(System.Math.Sinh(r2) / den, System.Math.Sin(i2) / den));
        }         // 823.29 ns
Example #2
0
        private static tComplex sin2(tComplex value)
        {
            double c  = System.Math.Cos(value.real);
            double sh = System.Math.Sinh(value.imag);

            return(new tComplex(
                       (System.Math.IEEERemainder(value.real, 2 * System.Math.PI) < System.Math.PI?1:-1) * System.Math.Sqrt(1 - c * c) * System.Math.Sqrt(1 + sh * sh),
                       c * sh));
        }
Example #3
0
        }         // 823.29 ns

        private static tComplex tanh2(tComplex value)
        {
            // std::complex より
            double t = System.Math.Tan(value.imag);
            double s = System.Math.Sinh(value.real);
            double b = s * (1 + t * t);
            double d = 1 + b * s;

            return(new tComplex(System.Math.Sqrt(1 + s * s) * b / d, t / d));
        }         // 540.17 ns
Example #4
0
 private static tComplex tanh0(tComplex value)
 {
     return(new tComplex(value.imag, value.real));
 }         // 77.30 ns
Example #5
0
 public static void bench_NanOrInfCheckLast2()
 {
     tComplex c = new tComplex(11.2321321, 37189371298.0);
     bool     r = c.IsInfinity2;
 }