diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-09-02 12:10:59 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 18:20:14 +0900 |
| commit | 08f61db6eeccf6a35435777c6deb55578f8817d8 (patch) | |
| tree | f9552fe216fb5c7f477bc2ad745db645921b8bda /mrbgems/mruby-math | |
| parent | 7f66e50ba2f71514da711a7927554956faea2f29 (diff) | |
| download | mruby-08f61db6eeccf6a35435777c6deb55578f8817d8.tar.gz mruby-08f61db6eeccf6a35435777c6deb55578f8817d8.zip | |
Skip some `Math.atan2()` tests.
Linux `atan2(3)` man page says:
```
If y is positive infinity (negative infinity) and x is positive infinity,
+pi/4 (-pi/4) is re‐ turned.
```
But on Microsoft VC/MinGW, `atan2()` returns `NaN` if either of
arguments is infinite. So we skip those tests on the platforms.
Diffstat (limited to 'mrbgems/mruby-math')
| -rw-r--r-- | mrbgems/mruby-math/test/math.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mrbgems/mruby-math/test/math.rb b/mrbgems/mruby-math/test/math.rb index d2790e289..959eef788 100644 --- a/mrbgems/mruby-math/test/math.rb +++ b/mrbgems/mruby-math/test/math.rb @@ -209,17 +209,18 @@ assert('Math.atan2') do assert_float(+Math::PI, Math.atan2(+0.0, -0.0)) assert_float(-Math::PI, Math.atan2(-0.0, -0.0)) + assert_float(0, Math.atan2(0, 1)) + assert_float(Math::PI / 4, Math.atan2(1, 1)) + assert_float(Math::PI / 2, Math.atan2(1, 0)) + inf = Float::INFINITY + skip "Math.atan2() return NaN" if Math.atan2(+inf, -inf).nan? expected = 3.0 * Math::PI / 4.0 assert_float(+expected, Math.atan2(+inf, -inf)) assert_float(-expected, Math.atan2(-inf, -inf)) expected = Math::PI / 4.0 assert_float(+expected, Math.atan2(+inf, +inf)) assert_float(-expected, Math.atan2(-inf, +inf)) - - assert_float(0, Math.atan2(0, 1)) - assert_float(Math::PI / 4, Math.atan2(1, 1)) - assert_float(Math::PI / 2, Math.atan2(1, 0)) end assert('Math.ldexp') do |
