File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ Base.iszero(x::Decimal) = iszero(x.c)
1919Base. isfinite (x:: Decimal ) = true
2020Base. isnan (x:: Decimal ) = false
2121
22+ if VERSION ≥ v " 1.13"
23+ Base. ispositive (x:: Decimal ) = ! x. s && ! iszero (x. c)
24+ Base. isnegative (x:: Decimal ) = x. s && ! iszero (x. c)
25+ end
26+
2227"""
2328 normalize(x::Decimal)
2429
Original file line number Diff line number Diff line change 5757
5858 @test isfinite (Decimal (0 , 1 , 1 ))
5959 @test ! isnan (Decimal (0 , 1 , 1 ))
60+
61+ if VERSION ≥ v " 1.13"
62+ @test ispositive (Decimal (0 , 1 , 0 ))
63+ @test ! ispositive (Decimal (0 , 0 , 1 ))
64+ @test ! ispositive (Decimal (1 , 1 , 0 ))
65+
66+ @test isnegative (Decimal (1 , 1 , 0 ))
67+ @test ! isnegative (Decimal (0 , 0 , 1 ))
68+ @test ! isnegative (Decimal (0 , 1 , 0 ))
69+ end
6070end
6171
6272@testset " Normalize" begin
You can’t perform that action at this time.
0 commit comments