Skip to content

Commit e0f721c

Browse files
authored
Merge pull request #64 from JuliaAlgebra/ratone
Implements one for rational
2 parents a3e840e + 9a3f64b commit e0f721c

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/rational.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ _minus(s::RationalPoly, p) = (s.num - p * s.den) / s.den
6565

6666
Base.zero(::RationalPoly{NT}) where {NT} = zero(NT)
6767
Base.zero(::Type{RationalPoly{NT, DT}}) where {NT, DT} = zero(NT)
68+
Base.one(::RationalPoly{NT}) where {NT} = one(NT)
69+
Base.one(::Type{RationalPoly{NT, DT}}) where {NT, DT} = one(NT)

test/rational.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
@test (1/x + 1/x) / 2 == ((1 / (x^2 - 1) + (x+1)) - (x+1)) * ((x^2 - 1) / x)
1313
#@test typeof(zero(1/x)) == Term{true, Int}
1414
@test iszero(zero(1/x))
15+
@test zero(1/x) == 0
16+
@test one(1/x) == 1
1517
#@test typeof(zero(RationalPoly{true, Float64, Int})) == Polynomial{true, Float64}
1618
#@test iszero(zero(RationalPoly{true, Float64, Int}))
1719
#@test typeof(x / 2) == Term{true, Float64}

0 commit comments

Comments
 (0)