summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime
diff options
context:
space:
mode:
authorTanner Gooding <tannergooding@users.noreply.github.com>2016-06-02 11:29:59 -0700
committerJan Vorlicek <janvorli@microsoft.com>2016-06-02 20:29:59 +0200
commit3d53df24c366c8f0c44196039279d34f78f72b3e (patch)
tree476e0625d8e0c62bc8ebcafb78605d073688b7eb /src/pal/tests/palsuite/c_runtime
parent7ba374cb4950e0c2ea8db5b982061dde99aef45a (diff)
downloadcoreclr-3d53df24c366c8f0c44196039279d34f78f72b3e.tar.gz
coreclr-3d53df24c366c8f0c44196039279d34f78f72b3e.tar.bz2
coreclr-3d53df24c366c8f0c44196039279d34f78f72b3e.zip
Fixing an error in PAL_pow that caused it to return an incorrect value for a couple scenarios. (#5399)
* Fixing an error in PAL_pow that caused it to return an incorrect value for a couple scenarios. * Adding additional PAL_pow tests.
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime')
-rw-r--r--src/pal/tests/palsuite/c_runtime/pow/test1/test1.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c
index 690ae947ac..0a05cd5a47 100644
--- a/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c
+++ b/src/pal/tests/palsuite/c_runtime/pow/test1/test1.c
@@ -91,26 +91,37 @@ int __cdecl main(int argc, char **argv)
struct test tests[] =
{
/* x y expected variance */
- { PAL_NEGINF, PAL_NEGINF, 0, PAL_EPSILON },
- { PAL_NEGINF, PAL_POSINF, PAL_POSINF, 0 },
-
- { -10, PAL_NEGINF, 0, PAL_EPSILON },
- { -10, -1, -0.1, PAL_EPSILON },
- { -10, 0, 1, PAL_EPSILON * 10 },
- { -10, 1, -10, PAL_EPSILON * 100 },
- { -10, PAL_POSINF, PAL_POSINF, 0 },
-
- { -2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e)
- { -2.7182818284590452, -1, -0.36787944117144232, PAL_EPSILON }, // x: -(e)
- { -2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: -(e)
- { -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e
- { -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e)
-
+ { PAL_NEGINF, PAL_NEGINF, 0, PAL_EPSILON },
+ { PAL_NEGINF, PAL_POSINF, PAL_POSINF, 0 },
+
+ { -10, PAL_NEGINF, 0, PAL_EPSILON },
+ { -10, -1, -0.1, PAL_EPSILON },
+ { -10, 0, 1, PAL_EPSILON * 10 },
+ { -10, 1, -10, PAL_EPSILON * 100 },
+ { -10, PAL_POSINF, PAL_POSINF, 0 },
+
+ { -2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON }, // x: -(e)
+ { -2.7182818284590452, -1, -0.36787944117144232, PAL_EPSILON }, // x: -(e)
+ { -2.7182818284590452, 0, 1, PAL_EPSILON * 10 }, // x: -(e)
+ { -2.7182818284590452, 1, -2.7182818284590452, PAL_EPSILON * 10 }, // x: -(e) expected: e
+ { -2.7182818284590452, PAL_POSINF, PAL_POSINF, 0 }, // x: -(e)
+
+ { -0.0, PAL_NEGINF, PAL_POSINF, 0 },
+ { -0.0, -1, PAL_NEGINF, 0 },
{ -0.0, -0.0, 1, PAL_EPSILON * 10 },
{ -0.0, 0, 1, PAL_EPSILON * 10 },
+ { -0.0, 1, -0.0, PAL_EPSILON },
+ { -0.0, PAL_POSINF, 0, PAL_EPSILON },
+ { 0.0, PAL_NEGINF, PAL_POSINF, 0 },
+ { 0.0, -1, PAL_POSINF, 0 },
{ 0, -0.0, 1, PAL_EPSILON * 10 },
{ 0, 0, 1, PAL_EPSILON * 10 },
+ { 0.0, 1, 0, PAL_EPSILON },
+ { 0.0, PAL_POSINF, 0, PAL_EPSILON },
+
+ { 1, PAL_NEGINF, 1, PAL_EPSILON * 10 },
+ { 1, PAL_POSINF, 1, PAL_EPSILON * 10 },
{ 2.7182818284590452, PAL_NEGINF, 0, PAL_EPSILON },
{ 2.7182818284590452, -3.1415926535897932, 0.043213918263772250, PAL_EPSILON / 10 }, // x: e y: -(pi)
@@ -199,6 +210,12 @@ int __cdecl main(int argc, char **argv)
validate_isnan(-2.7182818284590452, -0.78539816339744828); // x: -(e) y: -(pi / 4)
validate_isnan(-2.7182818284590452, 0.78539816339744828); // x: -(e) y: pi / 4
validate_isnan(-2.7182818284590452, 1.5707963267948966); // x: -(e) y: pi / 2
+
+ validate_isnan(-1, PAL_NEGINF);
+ validate_isnan(-1, PAL_POSINF);
+
+ validate_isnan(PAL_NAN, -0.0);
+ validate_isnan(PAL_NAN, 0);
validate_isnan(PAL_NEGINF, PAL_NAN);
validate_isnan(PAL_NAN, PAL_NEGINF);