A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/de/de4/fibonacci__large_8cpp_source.html below:

TheAlgorithms/C++: math/fibonacci_large.cpp Source File

Go to the documentation of this file. 38int main

(

int

argc,

char

*argv[]) {

41

N = strtoull(argv[1], NULL, 10);

43

std::cout <<

"Enter N: "

;

47

clock_t start_time = std::clock();

49

clock_t end_time = std::clock();

50 double

time_taken =

static_cast<double>

(end_time - start_time) /

51 static_cast<double>

(CLOCKS_PER_SEC);

53

std::cout << std::endl

54

<< N <<

"^th Fibonacci number: "

<<

result

<< std::endl

55

<<

"Number of digits: "

<<

result

.num_digits() << std::endl

56

<<

"Time taken: "

<< std::scientific << time_taken <<

" s" 62 "387896845438832563370191630832590531208212771464624510616059721489" 63 "555013904403709701082291646221066947929345285888297381348310200895" 64 "498294036143015691147893836421656394410691021450563413370655865623" 65 "825465670071252592990385493381392883637834751890876297071203333705" 66 "292310769300851809384980180384781399674888176555465378829164426891" 67 "298038461377896902150229308247566634622492307188332480328037503913" 68 "035290330450584270114763524227021093463769910400671417488329842289" 69 "149127310405432875329804427367682297724498774987455569190770388063" 70 "704683279481135897373999311010621930814901857081539785437919530561" 71 "751076105307568878376603366735544525884488624161921055345749367589" 72 "784902798823435102359984466393485325641195222185956306047536464547" 73 "076033090242080638258492915645287629157575914234380914230291749108" 74 "898415520985443248659407979357131684169286803954530954538869811466" 75 "508206686289742063932343848846524098874239587380197699382031717420" 76 "893226546887936400263079778005875912967138963421425257911687275560" 77 "0360311370547754724604639987588046985178408674382863125"

))

78

std::cout <<

"Test for "

<< N <<

"^th Fibonacci number passed!" 81

std::cerr <<

"Test for "

<< N <<

"^th Fibonacci number failed!"

large_number fib(uint64_t n)

uint64_t result(uint64_t n)

int main()

Main function.

Library to perform arithmatic operations on arbitrarily large numbers.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4