File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ import TestsUtils
1515public let Fibonacci = BenchmarkInfo (
1616 name: " Fibonacci " ,
1717 runFunction: run_Fibonacci,
18- tags: [ . unstable , . algorithm] )
18+ tags: [ . algorithm] )
1919
2020func fibonacci( _ n: Int ) -> Int {
21- if ( n < 2 ) { return 1 }
21+ if ( n <= 2 ) { return 1 }
2222 return fibonacci ( n - 2 ) + fibonacci( n - 1 )
2323}
2424
@@ -28,14 +28,14 @@ func Fibonacci(_ n: Int) -> Int {
2828 // at compile time.
2929 if False ( ) { return 0 }
3030
31- if ( n < 2 ) { return 1 }
31+ if ( n <= 2 ) { return 1 }
3232 return fibonacci ( n - 2 ) + fibonacci( n - 1 )
3333}
3434
3535@inline ( never)
3636public func run_Fibonacci( _ N: Int ) {
37- let n = 32
38- let ref_result = 3524578
37+ let n = 24
38+ let ref_result = 46368
3939 var result = 0
4040 for _ in 1 ... N {
4141 result = Fibonacci ( n)
You can’t perform that action at this time.
0 commit comments