mirror of
https://github.com/MartinThoma/LaTeX-examples.git
synced 2025-04-25 22:38:04 +02:00
Java-Bytecode und X10
This commit is contained in:
parent
d5ad212703
commit
50080ddea9
8 changed files with 503 additions and 6 deletions
|
@ -1,12 +1,12 @@
|
|||
// file Fibonacci.x10
|
||||
public class Fibonacci {
|
||||
public static def fib(n:Int): Int {
|
||||
public static def fib(n:Long): Long {
|
||||
if (n < 2) {
|
||||
return n;
|
||||
}
|
||||
|
||||
val f1:Int;
|
||||
val f2:Int;
|
||||
val f1:Long;
|
||||
val f2:Long;
|
||||
finish {
|
||||
async f1 = fib(n-1);
|
||||
async f2 = fib(n-2);
|
||||
|
@ -16,7 +16,7 @@ public class Fibonacci {
|
|||
|
||||
public static def main(args:Rail[String]) {
|
||||
x10.io.Console.OUT.println("This is fibonacci in X10.");
|
||||
for (var i:Int=0; i < 10; ++i) {
|
||||
for (var i:Long=0; i < 10; ++i) {
|
||||
x10.io.Console.OUT.println(i + ": " + fib(i));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue