Skip to content

Commit 3dfdc8e

Browse files
test: changed the example and added a comment to make it clear what the coefficients correspond to.
1 parent 22005cb commit 3dfdc8e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Math-Tests-Polynomials/PMPolynomialTest.class.st

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,12 @@ PMPolynomialTest >> testPolynomialRoots [
245245
{ #category : #'iterative algorithms' }
246246
PMPolynomialTest >> testPolynomialRootsForQuadratic [
247247
| polynomial roots |
248-
polynomial := PMPolynomial coefficients: #(1 2 1).
248+
"Here, compute the roots of the quadratic (2x + 1)^2 = 4 x^2 + 4 x + 1"
249+
polynomial := PMPolynomial coefficients: #(1 4 4).
249250
roots := polynomial roots .
250251
self assert: roots size equals: 2.
251-
self assert: (roots at: 1) closeTo: -1 .
252-
self assert: (roots at: 2) closeTo: -1 .
252+
self assert: (roots at: 1) closeTo: -0.5 .
253+
self assert: (roots at: 2) closeTo: -0.5 .
253254
]
254255

255256
{ #category : #'function evaluation' }

0 commit comments

Comments
 (0)