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
15
15
public let Fibonacci = BenchmarkInfo (
16
16
name: " Fibonacci " ,
17
17
runFunction: run_Fibonacci,
18
- tags: [ . unstable , . algorithm] )
18
+ tags: [ . algorithm] )
19
19
20
20
func fibonacci( _ n: Int ) -> Int {
21
- if ( n < 2 ) { return 1 }
21
+ if ( n <= 2 ) { return 1 }
22
22
return fibonacci ( n - 2 ) + fibonacci( n - 1 )
23
23
}
24
24
@@ -28,14 +28,14 @@ func Fibonacci(_ n: Int) -> Int {
28
28
// at compile time.
29
29
if False ( ) { return 0 }
30
30
31
- if ( n < 2 ) { return 1 }
31
+ if ( n <= 2 ) { return 1 }
32
32
return fibonacci ( n - 2 ) + fibonacci( n - 1 )
33
33
}
34
34
35
35
@inline ( never)
36
36
public func run_Fibonacci( _ N: Int ) {
37
- let n = 32
38
- let ref_result = 3524578
37
+ let n = 24
38
+ let ref_result = 46368
39
39
var result = 0
40
40
for _ in 1 ... N {
41
41
result = Fibonacci ( n)
You can’t perform that action at this time.
0 commit comments