# Search the Community

Showing results for tags 'Fibonacci number sequence'.

• ### Search By Tags

Type tags separated by commas.

### Forums

• General
• Announcements and Site News
• AutoIt v3
• AutoIt Help and Support
• AutoIt Technical Discussion
• AutoIt Example Scripts
• Scripting and Development
• Developer General Discussion
• Language Specific Discussion
• Operating System Deployment
• Windows Client
• Windows Server
• Office

### Categories

• AutoIt Team
• Beta
• MVP
• AutoIt
• Automation
• Databases and web connections
• Data compression
• Encryption and hash
• Games
• Hardware
• Information gathering
• Internet protocol suite
• Maths
• Media
• PDF
• Security
• Social Media and other Website API
• Windows
• Scripting and Development
• Operating System Deployment
• Windows Client
• Windows Server
• Office

• Forum FAQ
• AutoIt

### Calendars

• Community Calendar

• 0 Replies

• 0 Reviews

• 0 Views

Found 1 result

1. ## _Fibonacci() - Calculate the Fibonacci number of a decimal value.

This function will calculate the Finonacci number based on a decimal value. Function: ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Fibonacci ; Description ...: Calculate the Fibonacci number of a decimal value. ; Syntax ........: _Fibonacci(\$iIterations) ; Parameters ....: \$iIterations - An integer value to iterate to. ; Return values .: Success - Fibonacci value ; Author ........: guinness & UEZ ; Link ..........: C++ example: https://en.wikipedia.org/wiki/Functional_programming#Coding_styles ; Example .......: Yes ; =============================================================================================================================== Func _Fibonacci(\$iIterations) \$iIterations = Int(\$iIterations) Local \$iFirst = 0, \$iSecond = 1, \$iSum = 0 If \$iIterations > 92 Then \$iSecond = 1.0 EndIf For \$i = 0 To (\$iIterations - 1) \$iSum = \$iFirst + \$iSecond \$iFirst = \$iSecond \$iSecond = \$iSum Next Return \$iFirst EndFunc ;==>_FibonacciFunction V3.9.9.4+ ; #FUNCTION# ==================================================================================================================== ; Name ..........: _Fibonacci ; Description ...: Calculate the Fibonacci number of a decimal value. ; Syntax ........: _Fibonacci(\$iIterations) ; Parameters ....: \$iIterations - An integer value to iterate to. ; Return values .: Success - Fibonacci value ; Author ........: guinness & trancexx ; Link ..........: C++ example: https://en.wikipedia.org/wiki/Functional_programming#Coding_styles ; Example .......: Yes ; =============================================================================================================================== Func _Fibonacci(\$iIterations) \$iIterations = Int(\$iIterations) Local \$iFirst = 0, \$iSecond = (\$iIterations > 92) ? 1.0 : 1, \$iSum = 0 For \$i = 0 To (\$iIterations - 1) \$iSum = \$iFirst + \$iSecond \$iFirst = \$iSecond \$iSecond = \$iSum Next Return \$iFirst EndFunc ;==>_FibonacciExample use of Function: For \$i = 0 To 20 ConsoleWrite(\$i & ' >> ' & _Fibonacci(\$i) & @CRLF) Next
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...