|
1 | | -@testset "xlogx & xlogy" begin |
| 1 | +@testset "xlogx, xlogy, and xlog1py" begin |
2 | 2 | @test iszero(xlogx(0)) |
3 | 3 | @test xlogx(2) ≈ 2.0 * log(2.0) |
4 | 4 | @test_throws DomainError xlogx(-1) |
|
11 | 11 | @test isnan(xlogy(2, NaN)) |
12 | 12 | @test isnan(xlogy(0, NaN)) |
13 | 13 |
|
| 14 | + @test iszero(xlog1py(0, 0)) |
| 15 | + @test xlog1py(2, 3) ≈ 2.0 * log1p(3.0) |
| 16 | + @test_throws DomainError xlog1py(1, -2) |
| 17 | + @test isnan(xlog1py(NaN, 2)) |
| 18 | + @test isnan(xlog1py(2, NaN)) |
| 19 | + @test isnan(xlog1py(0, NaN)) |
| 20 | + |
14 | 21 | # Since we allow complex/negative values, test for them. See comments in: |
15 | 22 | # https://github.com/JuliaStats/StatsFuns.jl/pull/95 |
16 | 23 |
|
|
26 | 33 | @test isnan(xlogy(Inf + im * NaN, 1)) |
27 | 34 | @test isnan(xlogy(0 + im * 0, NaN)) |
28 | 35 | @test iszero(xlogy(0 + im * 0, 0 + im * Inf)) |
| 36 | + |
| 37 | + @test xlog1py(-2, 3) == -xlog1py(2, 3) |
| 38 | + @test xlog1py(1 + im, 3) == (1 + im) * log1p(3) |
| 39 | + @test xlog1py(1 + im, 2 + im) == (1 + im) * log1p(2 + im) |
| 40 | + @test isnan(xlog1py(1 + NaN * im, -1 + im)) |
| 41 | + @test isnan(xlog1py(0, -1 + NaN * im)) |
| 42 | + @test isnan(xlog1py(Inf + im * NaN, 1)) |
| 43 | + @test isnan(xlog1py(0 + im * 0, NaN)) |
| 44 | + @test iszero(xlog1py(0 + im * 0, -1 + im * Inf)) |
29 | 45 | end |
30 | 46 |
|
31 | 47 | @testset "logistic & logit" begin |
|
0 commit comments