|
|
|
@ -58,6 +58,12 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, 0.99999999999999289, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, -0.90175467375876572, -5.1528001100635277e-8)] |
|
|
|
[TestCase(-1.19209289550780998537e-7, -8.388608e6, double.PositiveInfinity, double.NegativeInfinity)] |
|
|
|
[TestCase(512.0, 32.0, -39356457675156.6, -3139507838262.74)] |
|
|
|
[TestCase(-512.0, -32.0, -39356457675156.6, -3139507838262.74)] |
|
|
|
[TestCase(32.0, -512.0, +9.52855589474963e+221, +6.29843301304523e+221)] |
|
|
|
[TestCase(-32.0, -512.0, +9.52855589474963e+221, -6.29843301304523e+221)] |
|
|
|
[TestCase(355.0, 355.0, -7.4732769989672537746e153, +2.25277102712558920722e149)] |
|
|
|
[TestCase(355.58, 355.58, -1.11645148443766450218e154, +7.31511888973169437082e153)] |
|
|
|
public void CanComputeComplexCosine(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Cos(); |
|
|
|
@ -79,6 +85,12 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, -1.19209289550780998537e-7, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, 0.43224820225680083, -1.0749753400787824e-7)] |
|
|
|
[TestCase(-1.19209289550780998537e-7, -8.388608e6, double.NegativeInfinity, double.NegativeInfinity)] |
|
|
|
[TestCase(512.0, 32.0, +3139507838262.74, -39356457675156.6)] |
|
|
|
[TestCase(-512.0, -32.0, -3139507838262.74, +39356457675156.6)] |
|
|
|
[TestCase(32.0, -512.0, +6.29843301304523e+221, -9.52855589474963e+221)] |
|
|
|
[TestCase(-32.0, -512.0, -6.29843301304523e+221, -9.52855589474963e+221)] |
|
|
|
[TestCase(355.0, 355.0, -2.25277102712558920722e149, -7.4732769989672537746e153)] |
|
|
|
[TestCase(355.58, 355.58, -+7.31511888973169437082e153, -1.11645148443766450218e154)] |
|
|
|
public void CanComputeComplexSine(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Sin(); |
|
|
|
@ -100,6 +112,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, -1.1920928955078157e-7, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, -0.47934123862653449, 1.4659977233982276e-7)] |
|
|
|
[TestCase(-8.388608e6, -1.19209289550780998537e-7, 0.47934123862653449, -1.4659977233982276e-7)] |
|
|
|
[TestCase(512.0, 32.0, -5.08515122860094E-29, 1)] |
|
|
|
[TestCase(-512.0, -32.0, +5.08515122860094E-29, -1)] |
|
|
|
[TestCase(32.0, 512.0, +3.52598650243739e-445, 1)] |
|
|
|
[TestCase(32.0, -512.0, +3.52598650243739e-445, -1)] |
|
|
|
[TestCase(355.0, 355.0, +5.39739014654622322424e-313, +1.0)] |
|
|
|
[TestCase(355.58, 355.58, +2.57308259096360322163e-309, +1.0)] |
|
|
|
[TestCase(196.0, 16.0, +1.62991625102252204721e-14, +1.00000000000001938715)] |
|
|
|
public void CanComputeComplexTangent(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Tan(); |
|
|
|
@ -319,6 +338,7 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
/// <param name="expected">Expected value.</param>
|
|
|
|
[TestCase(1.0, 0.0)] |
|
|
|
[TestCase(8388608, 16.635532333438682)] |
|
|
|
[TestCase(1.7976931348623157E+308, 710.47586007394394203711)] |
|
|
|
public void CanComputeInverseHyperbolicCosine(double value, double expected) |
|
|
|
{ |
|
|
|
var actual = Trig.Acosh(value); |
|
|
|
@ -364,6 +384,8 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-8388608, -16.63553233343869)] |
|
|
|
[TestCase(1.19209289550780998537e-7, 1.1920928955078072e-7)] |
|
|
|
[TestCase(-1.19209289550780998537e-7, -1.1920928955078072e-7)] |
|
|
|
[TestCase(1.7976931348623157E+308, 710.47586007394394203711)] |
|
|
|
[TestCase(-1.7976931348623157E+308, -710.47586007394394203711)] |
|
|
|
public void CanComputeInverseHyperbolicSine(double value, double expected) |
|
|
|
{ |
|
|
|
var actual = Trig.Asinh(value); |
|
|
|
@ -549,6 +571,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, -8388607.999999978, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, -2.0861964701080704, -6.3803383253713457e-7)] |
|
|
|
[TestCase(-8.388608e6, -1.19209289550780998537e-7, 2.0861964701080704, 6.3803383253713457e-7)] |
|
|
|
[TestCase(512.0, 32.0, -5.08515122860094E-29, -1.0)] |
|
|
|
[TestCase(-512.0, -32.0, 5.08515122860094E-29, +1.0)] |
|
|
|
[TestCase(32.0, 512.0, +3.52598650243739e-445, -1.0)] |
|
|
|
[TestCase(32.0, -512.0, +3.52598650243739e-445, +1.0)] |
|
|
|
[TestCase(355.0, 355.0, +5.39739014654622322424e-313, -1.0)] |
|
|
|
[TestCase(355.58, 355.58, +2.57308259096360322163e-309, -1.0)] |
|
|
|
[TestCase(196.0, 16.0, +1.62991625102252204721e-14, -1.00000000000001938715)] |
|
|
|
public void CanComputeComplexCotangent(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Cot(); |
|
|
|
@ -570,6 +599,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, 1.0000000000000071, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, -1.1089490624226177, 6.3367488045143761e-8)] |
|
|
|
[TestCase(-8.388608e6, -1.19209289550780998537e-7, -1.1089490624226177, 6.3367488045143761e-8)] |
|
|
|
[TestCase(512.0, 32.0, -2.52481261731330570134e-14, +2.01407074478744036413e-15)] |
|
|
|
[TestCase(-512.0, -32.0, -2.52481261731330570134e-14, +2.01407074478744036413e-15)] |
|
|
|
[TestCase(32.0, 512.0, +7.30361056703505e-223, +4.82773070945482e-223)] |
|
|
|
[TestCase(32.0, -512.0, +7.30361056703505e-223, -4.82773070945482e-223)] |
|
|
|
[TestCase(355.0, 355.0, -1.33810107564527561878e-154, -4.03361916732891580715e-159)] |
|
|
|
[TestCase(355.58, 355.58, -6.26665948010988663559e-155, -4.10598756663013051681e-155)] |
|
|
|
[TestCase(196.0, 16.0, +7.70790453157574313253e-8, +2.11460357915116320189e-7)] |
|
|
|
public void CanComputeComplexSecant(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Sec(); |
|
|
|
@ -591,6 +627,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(-1.19209289550780998537e-7, 0.0, -8388608.0000000376, 0.0)] |
|
|
|
[TestCase(8.388608e6, 1.19209289550780998537e-7, 2.3134856195557596, 5.7534999050657057e-7)] |
|
|
|
[TestCase(-8.388608e6, -1.19209289550780998537e-7, -2.3134856195557596, -5.7534999050657057e-7)] |
|
|
|
[TestCase(512.0, 32.0, 2.01407074478744e-15, 2.52481261731331e-14)] |
|
|
|
[TestCase(-512.0, -32.0, -2.01407074478744e-15, -2.52481261731331e-14)] |
|
|
|
[TestCase(32.0, 512.0, +4.82773070945482e-223, -7.30361056703505e-223)] |
|
|
|
[TestCase(32.0, -512.0, +4.82773070945482e-223, +7.30361056703505e-223)] |
|
|
|
[TestCase(355.0, 355.0, -4.03361916732891580715e-159, +1.33810107564527561878e-154)] |
|
|
|
[TestCase(355.58, 355.58, -4.10598756663013051681e-155, +6.26665948010988663559e-155)] |
|
|
|
[TestCase(196.0, 16.0, +2.11460357915116320189e-7, -7.70790453157574313253e-8)] |
|
|
|
public void CanComputeComplexCosecant(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Csc(); |
|
|
|
@ -616,6 +659,11 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 0.45730415318424922, -0.54061268571315335)] |
|
|
|
[TestCase(-0.5, 0.5, -0.45730415318424922, 0.54061268571315335)] |
|
|
|
[TestCase(-0.5, -0.5, -0.45730415318424922, -0.54061268571315335)] |
|
|
|
[TestCase(512.0, 32.0, 9.52855589474962752845e221, 6.29843301304522728211e221)] |
|
|
|
[TestCase(-512.0, -32.0, -9.52855589474962752845e221, -6.29843301304522728211e221)] |
|
|
|
[TestCase(-32.0, 512.0, +3.93564576751566e13, +3.13950783826274e12)] |
|
|
|
[TestCase(32.0, -512.0, -3.93564576751566e13, -3.13950783826274e12)] |
|
|
|
[TestCase(709.0, 709.0, +2.22042071181169647963e307, -3.45764185010438140812e307)] |
|
|
|
public void CanComputeComplexHyperbolicSine(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Sinh(); |
|
|
|
@ -641,6 +689,11 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 0.9895848833999199, -0.24982639750046154)] |
|
|
|
[TestCase(-0.5, 0.5, 0.9895848833999199, -0.24982639750046154)] |
|
|
|
[TestCase(-0.5, -0.5, 0.9895848833999199, 0.24982639750046154)] |
|
|
|
[TestCase(512.0, 32.0, 9.52855589474962752845e221, 6.29843301304522728211e221)] |
|
|
|
[TestCase(-512.0, -32.0, 9.52855589474962752845e221, 6.29843301304522728211e221)] |
|
|
|
[TestCase(-32.0, 512.0, -3.93564576751566e13, -3.13950783826274e12)] |
|
|
|
[TestCase(32.0, -512.0, -3.93564576751566e13, -3.13950783826274e12)] |
|
|
|
[TestCase(709.0, 709.0, +2.22042071181169647963e307, -3.45764185010438140812e307)] |
|
|
|
public void CanComputeComplexHyperbolicCosine(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Cosh(); |
|
|
|
@ -666,6 +719,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 0.56408314126749848, -0.40389645531602575)] |
|
|
|
[TestCase(-0.5, 0.5, -0.56408314126749848, 0.40389645531602575)] |
|
|
|
[TestCase(-0.5, -0.5, -0.56408314126749848, -0.40389645531602575)] |
|
|
|
[TestCase(512.0, 32.0, 1.0, 0.0)] |
|
|
|
[TestCase(-512.0, -32.0, -1.0, 0.0)] |
|
|
|
[TestCase(-32.0, 512.0, -1.0, -5.08515122860093626173e-29)] |
|
|
|
[TestCase(32.0, -512.0, +1.0, +5.08515122860093626173e-29)] |
|
|
|
[TestCase(355.0, 355.0, +1.0, +5.39739014654622322424e-313)] |
|
|
|
[TestCase(355.58, 355.58, +1.0, +2.57308259096360322163e-309)] |
|
|
|
[TestCase(196.0, 16.0, +1.0, +6.29623407730470174659e-171)] |
|
|
|
public void CanComputeComplexHyperbolicTangent(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Tanh(); |
|
|
|
@ -691,6 +751,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 1.1719451445243514, 0.8391395790248311)] |
|
|
|
[TestCase(-0.5, 0.5, -1.1719451445243514, -0.8391395790248311)] |
|
|
|
[TestCase(-0.5, -0.5, -1.1719451445243514, 0.8391395790248311)] |
|
|
|
[TestCase(512.0, 32.0, 1.0, 0.0)] |
|
|
|
[TestCase(-512.0, -32.0, -1.0, 0.0)] |
|
|
|
[TestCase(-32.0, 512.0, -1.0, 5.08515122860093626173e-29)] |
|
|
|
[TestCase(32.0, -512.0, +1.0, -5.08515122860093626173e-29)] |
|
|
|
[TestCase(355.0, 355.0, +1.0, -5.39739014654622322424e-313)] |
|
|
|
[TestCase(355.58, 355.58, +1.0, -2.57308259096360322163e-309)] |
|
|
|
[TestCase(196.0, 16.0, +1.0, -6.29623407730470174659e-171)] |
|
|
|
public void CanComputeComplexHyperbolicCotangent(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Coth(); |
|
|
|
@ -716,6 +783,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 0.94997886761549463, 0.23982763093808804)] |
|
|
|
[TestCase(-0.5, 0.5, 0.94997886761549463, 0.23982763093808804)] |
|
|
|
[TestCase(-0.5, -0.5, 0.94997886761549463, -0.23982763093808804)] |
|
|
|
[TestCase(512.0, 32.0, 7.30361056703505051822e-223, -4.82773070945482080706e-223)] |
|
|
|
[TestCase(-512.0, -32.0, 7.30361056703505051822e-223, -4.82773070945482080706e-223)] |
|
|
|
[TestCase(-32.0, 512.0, -2.52481261731330570134e-14, +2.01407074478744036413e-15)] |
|
|
|
[TestCase(-32.0, -512.0, -2.52481261731330570134e-14, -2.01407074478744036413e-15)] |
|
|
|
[TestCase(355.0, 355.0, -1.33810107564527561878e-154, +4.03361916732891580715e-159)] |
|
|
|
[TestCase(355.58, 355.58, -6.26665948010988663559e-155, +4.10598756663013051681e-155)] |
|
|
|
[TestCase(196.0, 16.0, -1.447180343166980306269e-85, +4.350690711792111509525e-86)] |
|
|
|
public void CanComputeComplexHyperbolicSecant(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Sech(); |
|
|
|
@ -741,6 +815,13 @@ namespace MathNet.Numerics.UnitTests |
|
|
|
[TestCase(0.5, -0.5, 0.91207426403881078, 1.0782296946540223)] |
|
|
|
[TestCase(-0.5, 0.5, -0.91207426403881078, -1.0782296946540223)] |
|
|
|
[TestCase(-0.5, -0.5, -0.91207426403881078, 1.0782296946540223)] |
|
|
|
[TestCase(512.0, 32.0, 7.30361056703505051822e-223, -4.82773070945482080706e-223)] |
|
|
|
[TestCase(-512.0, -32.0, -7.30361056703505051822e-223, +4.82773070945482080706e-223)] |
|
|
|
[TestCase(-32.0, 512.0, +2.52481261731330570134e-14, -2.01407074478744036413e-15)] |
|
|
|
[TestCase(32.0, -512.0, -2.52481261731330570134e-14, +2.01407074478744036413e-15)] |
|
|
|
[TestCase(355.0, 355.0, -1.33810107564527561878e-154, +4.03361916732891580715e-159)] |
|
|
|
[TestCase(355.58, 355.58, -6.26665948010988663559e-155, +4.10598756663013051681e-155)] |
|
|
|
[TestCase(196.0, 16.0, -1.447180343166980306269e-85, +4.350690711792111509525e-86)] |
|
|
|
public void CanComputeComplexHyperbolicCosecant(double real, double imag, double expectedReal, double expectedImag) |
|
|
|
{ |
|
|
|
var actual = new Complex(real, imag).Csch(); |
|
|
|
|