RosettaCodeData/Task/Trabb-Pardo-Knuth-algorithm/AutoIt/trabb-pardo-knuth-algorithm...

25 lines
516 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

; Trabb PardoKnuth algorithm
; by James1337 (autoit.de)
; AutoIt Version: 3.3.8.1
Local $S, $i, $y
Do
$S = InputBox("Trabb PardoKnuth algorithm", "Please enter 11 numbers:", "1 2 3 4 5 6 7 8 9 10 11")
If @error Then Exit
$S = StringSplit($S, " ")
Until ($S[0] = 11)
For $i = 11 To 1 Step -1
$y = f($S[$i])
If ($y > 400) Then
ConsoleWrite("f(" & $S[$i] & ") = Overflow!" & @CRLF)
Else
ConsoleWrite("f(" & $S[$i] & ") = " & $y & @CRLF)
EndIf
Next
Func f($x)
Return Sqrt(Abs($x)) + 5*$x^3
EndFunc