From db77d6001ee7d38b319552353f430365d942cbbc Mon Sep 17 00:00:00 2001 From: PanSi21 Date: Sun, 5 Jan 2025 00:18:58 +0100 Subject: [PATCH] Aggiorna index.js --- index.js | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/index.js b/index.js index 42c15a3..433cdb3 100644 --- a/index.js +++ b/index.js @@ -2,26 +2,6 @@ import { cc } from "bun:ffi"; import source from "./test.c" with { type: "file" }; -function fibonacci_js() { - const n = 500000; - let a = 0n; - let b = 1n; - let c; - - for (let i = 2; i <= n; i++) { - c = a + b; - a = b; - b = c; - } - - return b; -} - -const result_js = fibonacci_js(); -console.log("Fibonacci(500000) =", result_js.toString()); - - - const { symbols: { fibonacci }, } = cc({ @@ -36,5 +16,24 @@ const { const risultato = fibonacci(); -console.log("fibonacci serie 500 000: ", risultato ); +console.log("fibonacci serie 250 000: ", risultato ); +// + +function fibonacci_js() { + const n = 250000; + let a = 0n; + let b = 1n; + let c; + + for (let i = 2; i <= n; i++) { + c = a + b; + a = b; + b = c; + } + + return b; +} + +const result_js = fibonacci_js(); +console.log("Fibonacci(250 000) =", result_js.toString());