Skip to content

Commit 47c8c47

Browse files
committed
Remove unused temporaries
1 parent bc8ee23 commit 47c8c47

File tree

5 files changed

+23
-72
lines changed

5 files changed

+23
-72
lines changed

src/Math-ODE/PMExplicitStepper.class.st

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ PMExplicitStepper >> doStep: aState time: t [
3333
{ #category : #stepping }
3434
PMExplicitStepper >> doStep: aState time: t stepSize: timeStep [
3535
"This method should take one step from inState at time t of size dt, and modify the state, then answer it. The default implementation here is Euler Method. Subclasses should override"
36-
| dxdt |
36+
3737
self stepSize: timeStep.
38-
^ self doStep: aState time: t.
38+
^ self doStep: aState time: t
3939
]
4040

4141
{ #category : #stepping }

src/Math-Tests-ArbitraryPrecisionFloat/PMArbitraryPrecisionFloatTest.class.st

Lines changed: 7 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,7 @@ PMArbitraryPrecisionFloatTest >> testArcCos [
162162
"seconds"
163163

164164
<timeout: 10>
165-
| badArcCos |
166-
badArcCos := self
167-
checkDoublePrecisionSerieVsFloat: self inverseTrigonometricSerie
168-
forFunction: #arcCos.
169-
"badArcCos isEmpty
170-
ifFalse: [ Transcript
171-
cr;
172-
show: 'bad arcCos for ' , badArcCos printString ]"
165+
self checkDoublePrecisionSerieVsFloat: self inverseTrigonometricSerie forFunction: #arcCos
173166
]
174167

175168
{ #category : #'testing-trigonometry' }
@@ -183,14 +176,7 @@ PMArbitraryPrecisionFloatTest >> testArcSin [
183176
"seconds"
184177

185178
<timeout: 10>
186-
| badArcSin |
187-
badArcSin := self
188-
checkDoublePrecisionSerieVsFloat: self inverseTrigonometricSerie
189-
forFunction: #arcSin.
190-
" badArcSin isEmpty
191-
ifFalse: [ Transcript
192-
cr;
193-
show: 'bad arcSin for ' , badArcSin printString ]"
179+
self checkDoublePrecisionSerieVsFloat: self inverseTrigonometricSerie forFunction: #arcSin
194180
]
195181

196182
{ #category : #'testing-trigonometry' }
@@ -204,15 +190,9 @@ PMArbitraryPrecisionFloatTest >> testArcTan [
204190
"seconds"
205191

206192
<timeout: 10>
207-
| badArcTan serie |
193+
| serie |
208194
serie := (-50 to: 50) collect: [ :e | (e / 10) asFloat ].
209-
badArcTan := self
210-
checkDoublePrecisionSerieVsFloat: serie
211-
forFunction: #arcTan.
212-
" badArcTan isEmpty
213-
ifFalse: [ Transcript
214-
cr;
215-
show: 'bad arcTan for ' , badArcTan printString ]"
195+
self checkDoublePrecisionSerieVsFloat: serie forFunction: #arcTan
216196
]
217197

218198
{ #category : #'testing-trigonometry' }
@@ -397,16 +377,7 @@ PMArbitraryPrecisionFloatTest >> testCos [
397377
"seconds"
398378

399379
<timeout: 30>
400-
| badCos |
401-
badCos := self
402-
checkDoublePrecisionSerieVsFloat: self trigonometricSerie
403-
forFunction: #cos.
404-
" badCos isEmpty
405-
ifFalse: [ Transcript
406-
cr;
407-
show:
408-
'bad cos for angles (degrees) '
409-
, (badCos collect: [ :i | i radiansToDegrees rounded ]) printString ]"
380+
self checkDoublePrecisionSerieVsFloat: self trigonometricSerie forFunction: #cos
410381
]
411382

412383
{ #category : #'testing-hyperbolic' }
@@ -788,16 +759,7 @@ PMArbitraryPrecisionFloatTest >> testSin [
788759
"seconds"
789760

790761
<timeout: 30>
791-
| badSin |
792-
badSin := self
793-
checkDoublePrecisionSerieVsFloat: self trigonometricSerie
794-
forFunction: #sin.
795-
" badSin isEmpty
796-
ifFalse: [ Transcript
797-
cr;
798-
show:
799-
'bad sin for angles (degrees) '
800-
, (badSin collect: [ :i | i radiansToDegrees rounded ]) printString ]"
762+
self checkDoublePrecisionSerieVsFloat: self trigonometricSerie forFunction: #sin
801763
]
802764

803765
{ #category : #'testing-trigonometry' }
@@ -878,16 +840,7 @@ PMArbitraryPrecisionFloatTest >> testTan [
878840
"seconds"
879841

880842
<timeout: 30>
881-
| badTan |
882-
badTan := self
883-
checkDoublePrecisionSerieVsFloat: self trigonometricSerie
884-
forFunction: #tan.
885-
" badTan isEmpty
886-
ifFalse: [ Transcript
887-
cr;
888-
show:
889-
'bad tan for angles (degrees) '
890-
, (badTan collect: [ :i | i radiansToDegrees rounded ]) printString ]"
843+
self checkDoublePrecisionSerieVsFloat: self trigonometricSerie forFunction: #tan
891844
]
892845

893846
{ #category : #'testing-hyperbolic' }

src/Math-Tests-Complex/PMComplexNumberTest.class.st

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -546,13 +546,13 @@ PMComplexNumberTest >> testNew [
546546
{ #category : #'testing - expressing complex numbers' }
547547
PMComplexNumberTest >> testNormalizedFractionsOfComplexNumbersCannotBeWritten [
548548

549-
| z w numerator denominator |
549+
| z w numerator |
550550
z := 1 + 2 i.
551551
w := 3 + 4 i.
552552
numerator := z * w complexConjugate.
553-
denominator := w squaredNorm.
554-
555-
self should: [ Fraction numerator: numerator denominator: w squaredNorm ] raise: Exception.
553+
w squaredNorm.
554+
555+
self should: [ Fraction numerator: numerator denominator: w squaredNorm ] raise: Exception
556556
]
557557

558558
{ #category : #'testing - close to' }

src/Math-Tests-KDTree/PMNNStoreTest.class.st

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,14 @@ PMNNStoreTest >> testNewFrom [
176176
{ #category : #tests }
177177
PMNNStoreTest >> testWithAll [
178178

179-
| n array |
179+
| n |
180180
n := PMNNStore withAll: #( 2 5 4 ).
181-
self
182-
assert: n completeData
183-
equals: #( #( nil 2 ) #( nil 5 ) #( nil 4 ) ).
181+
self assert: n completeData equals: #( #( nil 2 ) #( nil 5 ) #( nil 4 ) ).
184182
n sortFor: nil. "calling sortFor: is necessary with withAll:"
185183
self assert: n data equals: #( 2 4 5 ).
186184
self assert: n isFull.
187-
n add: #(3 6) copy.
188-
185+
n add: #( 3 6 ) copy.
186+
189187
"one has to be a bit carefull when one uses
190188
PMNNStore withAll:, as sortfor: changes this data.
191189
n add: #(3 6) is not possible here!"

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Class {
22
#name : #PMPolynomialTest,
33
#superclass : #TestCase,
4-
#category : 'Math-Tests-Polynomials'
4+
#category : #'Math-Tests-Polynomials'
55
}
66

77
{ #category : #comparing }
@@ -56,11 +56,11 @@ PMPolynomialTest >> testPolynomialDivision [
5656
{ #category : #'function evaluation' }
5757
PMPolynomialTest >> testPolynomialDivisionBug [
5858
"identify an error when trying to create a zero dividend"
59-
| pol1 pol2 polynomial |
60-
pol1 := PMPolynomial coefficients: #(2 -3 1).
61-
pol2 := PMPolynomial coefficients: #(-6 23 -20 3 -1 1).
62-
self shouldnt: [polynomial := pol1 / pol2] raise: Error.
63-
59+
60+
| pol1 pol2 |
61+
pol1 := PMPolynomial coefficients: #( 2 -3 1 ).
62+
pol2 := PMPolynomial coefficients: #( -6 23 -20 3 -1 1 ).
63+
self shouldnt: [ pol1 / pol2 ] raise: Error
6464
]
6565

6666
{ #category : #arithmetic }

0 commit comments

Comments
 (0)