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)
19
19
Base. isfinite (x:: Decimal ) = true
20
20
Base. isnan (x:: Decimal ) = false
21
21
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
+
22
27
"""
23
28
normalize(x::Decimal)
24
29
Original file line number Diff line number Diff line change 57
57
58
58
@test isfinite (Decimal (0 , 1 , 1 ))
59
59
@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
60
70
end
61
71
62
72
@testset " Normalize" begin
You can’t perform that action at this time.
0 commit comments