Skip to content

Commit afce991

Browse files
authored
Merge pull request #121 from jverzani/fix120
fix #120
2 parents 227b3ac + b8a2f33 commit afce991

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Polynomials.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ julia> roots(poly([1,2,3,4]))
624624
function roots{T}(p::Poly{T})
625625
R = promote_type(T, Float64)
626626
length(p) == 0 && return zeros(R, 0)
627-
p = truncate(p)
627+
628628
num_leading_zeros = 0
629629
while p[num_leading_zeros] zero(T)
630630
if num_leading_zeros == length(p)-1

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ a_roots = copy(pN.a)
7070
@test length(roots(p5)) == 4
7171
@test roots(pNULL) == []
7272
@test sort(roots(pR)) == [1//2, 3//2]
73+
x = variable(Float64)
74+
plarge = 8.362779449448982e41 - 2.510840694154672e57x + 4.2817430781178795e44x^2 - 1.6225927682921337e31x^3 + 1.0x^4 # #120
75+
@test length(roots(plarge)) == 4
76+
7377

7478
@test pNULL + 2 == p0 + 2 == 2 + p0 == Poly([2])
7579
@test p2 - 2 == -2 + p2 == Poly([-1,1])

0 commit comments

Comments
 (0)