TPK algorithm: Difference between revisions

Content deleted Content added
Rewritten the Groovy implementation
m Modified Groovy implementation
Line 93:
}
</source>
 
 
===[[Groovy (programming language)|Groovy]]===
<source lang="Groovy">
def f(x) {
Math.sqrt(Math.abs(x)) + 5 * x**3
}
 
def grooVals = []
def scanner = new Scanner(System.in)
Line 104 ⟶ 107:
grooVals = grooVals.reverse()
for (val in grooVals) {
def calcVal = Math.sqrt(Math.absf(val)) + 5 * val**3
if (calcVal.isInfinite())
println 'TOO LARGE'