See the difference (BigInt in C++ and Python) | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 103

See the difference (BigInt in C++ and Python)

Rei: To clarify on OP's behalf: Python supports int values of arbitrary size, C++ does not. This is because Python focuses on achieving results quickly, while C++ primes in runtime performance, letting you decide the optimal structure to deal with BigInt. This thread is not an attack on C++. There are also well-written, ready-to-use C++ BigInt libraries online, e.g. https://github.com/sercantutar/infint https://code.sololearn.com/caP8649IZ2fH/?ref=app https://code.sololearn.com/cQKjPRAb6JcZ/?ref=app

13th Apr 2018, 8:32 AM
AliRą«Æza
AliRą«Æza - avatar
60 Respostas
+ 24
Congratulations, you made me write code. https://code.sololearn.com/cqtn357OfStn/?ref=app
18th Apr 2018, 5:34 AM
Hatsy Rei
Hatsy Rei - avatar
+ 118
Sorry, but your C++ code is just overkill. You can do the same calculation in C++ with only 1 line of code and thereby reach a sufficient precision, too: https://code.sololearn.com/c81HCw3Wbohj/#cpp
13th Apr 2018, 7:12 PM
Chris
Chris - avatar
+ 64
In programmer performance, Python is superior. In runtime performance C++ is superior. So the tool of choice for code that only needs to run occasionally is Python. When code needs to run often or runs on a battery powered device, you might want to consider C++.
13th Apr 2018, 3:51 PM
Freddy
+ 30
Yes, you can easily calculate 40 numbers more. That's because Python doesn't have a native variable limit like C++ does. The limit has a reason though. C++ and Python are different languages with different strenghts used for different purposes, so there's no point in badmouthing a language because of something it wasn't built for. Such integer precision doesn't have any practical use in C++ applications and I can assure you that nobody read past the 10th number. You will never write 60 lines to get some extra precision in a calculation and you'll still get a good enough result. Furthermore, C++ calculates 94 Fibonacci numbers way faster than Python does. I see your point, but your statement is very misleading.
13th Apr 2018, 9:33 PM
Chris
Chris - avatar
+ 28
Chris totally my post has joking aspect , i want show a small limit can make the code too long And about function , it's very simple , i will write how it works in next few days
13th Apr 2018, 9:46 PM
AliRą«Æza
AliRą«Æza - avatar
+ 23
Chris & another thing It's not just 30 line code to calculate 40 another numbers that as you said nobody cares about that It's good training for beginners and for my future project šŸ˜‰
13th Apr 2018, 10:23 PM
AliRą«Æza
AliRą«Æza - avatar
+ 23
Hatsy Rei awesome šŸ‘
18th Apr 2018, 8:03 AM
AliRą«Æza
AliRą«Æza - avatar
+ 22
wd00009 thank you šŸ˜„ā¤
17th Apr 2018, 12:42 PM
AliRą«Æza
AliRą«Æza - avatar
+ 20
The thing is, you're nowhere explicitely telling that your statement is about the length of the numbers you're calculating. You're linking two codes called "Fibonacci series", saying that the C++ one is 60 times longer, and that's it. There's no mention about a joking aspect or what you are actually trying to achieve here. Yes, it's good training. But you're implicitely making people think that Python is superior by giving a false positive example.
14th Apr 2018, 12:34 AM
Chris
Chris - avatar
+ 18
Naman just read the comments in this post to understand why this contain 64 line
14th Apr 2018, 4:29 AM
AliRą«Æza
AliRą«Æza - avatar
+ 18
Costin Onciu anyway C has limit for variables even if using array or not
14th Apr 2018, 9:51 AM
AliRą«Æza
AliRą«Æza - avatar
+ 18
Freddy awesome idea but how can convert string to number ?! šŸ¤”
14th Apr 2018, 12:54 PM
AliRą«Æza
AliRą«Æza - avatar
+ 17
Fistefalo сŠµŃ€Šøя чŠøсŠµŠ», Š² ŠŗŠ¾Ń‚Š¾Ń€Ń‹Ń… ŠŗŠ°Š¶Š“Š¾Šµ чŠøсŠ»Š¾ (чŠøсŠ»Š¾ Š¤ŠøŠ±Š¾Š½Š°Ń‡Ń‡Šø) яŠ²Š»ŃŠµŃ‚ся суŠ¼Š¼Š¾Š¹ Š“Š²ŃƒŃ… ŠæрŠµŠ“ыŠ“ущŠøх чŠøсŠµŠ». ŠŸŃ€Š¾ŃŃ‚ŠµŠ¹ŃˆŠøŠ¼ яŠ²Š»ŃŠµŃ‚ся ряŠ“ 1, 1, 2, 3, 5, 8,
13th Apr 2018, 8:50 PM
AliRą«Æza
AliRą«Æza - avatar
+ 17
phyton vs c++ is amazing coder its so wow magic
17th Apr 2018, 4:32 AM
Nina Hendra Putri
Nina Hendra Putri - avatar
+ 16
Chris you forgot one thing , that my code can calculate fibonacci series up to 141th number (not 94th as you wrote), i wrote 30 rows code to break that limit brošŸ˜‰ #look_carefully #eyes_wide_shut goodluck
13th Apr 2018, 8:03 PM
AliRą«Æza
AliRą«Æza - avatar
+ 16
Fistefalo Š“Š°, я Š“ŠµŠ»Š°ŃŽ тŠ¾Ń‚ Š¶Šµ ŠŗŠ¾Š“, Š½Š¾, Šŗ сŠ¾Š¶Š°Š»ŠµŠ½Šøю, Š² c ++, ŠæŠ¾ŃŠŗŠ¾Š»ŃŒŠŗу Š²Ń‹ Š·Š½Š°ŠµŃ‚Šµ, чтŠ¾ у Š½Š°Ń ŠµŃŃ‚ŃŒ Š¾Š³Ń€Š°Š½ŠøчŠµŠ½ŠøŠµ ŠæŠµŃ€ŠµŠ¼ŠµŠ½Š½Š¾Š¹, ŠŗŠ¾Ń‚Š¾Ń€Š¾Šµ Š½Šµ Š¼Š¾Š¶ŠµŃ‚ хрŠ°Š½Šøть Š²ŠµŃ€Ń…Š½ŠøŠµ Š·Š½Š°Ń‡ŠµŠ½Šøя 18 * (10 ^ 18), ŠæŠ¾ŃŃ‚Š¾Š¼Ńƒ я Š½Š°ŠæŠøсŠ°Š» сŠ»ŠøшŠŗŠ¾Š¼ Š“Š»ŠøŠ½Š½Ń‹Š¹ ŠŗŠ¾Š“, чтŠ¾Š±Ń‹ рŠ°Š·Š±Šøть этŠ¾Ń‚ ŠæрŠµŠ“ŠµŠ» Šø Š²Ń‹Ń‡ŠøсŠ»Šøть 141-Šµ чŠøсŠ»Š¾ фŠøŠ±Š¾Š½Š°Ń‡Ń‡Šø с 30 цŠøфр цŠµŠ»Ń‹Ń… чŠøсŠµŠ» :)
13th Apr 2018, 9:26 PM
AliRą«Æza
AliRą«Æza - avatar
+ 14
OMG i should learn phython soon.
13th Apr 2018, 8:34 AM
šŸ¦‹FEATHERšŸ¦‹
šŸ¦‹FEATHERšŸ¦‹ - avatar
+ 13
Fistefalo я Š½Šµ ŠæŠ¾Š½ŠøŠ¼Š°ŃŽ, чтŠ¾ Š²Ń‹ ŠøŠ¼ŠµŠµŃ‚Šµ Š² Š²ŠøŠ“у !
13th Apr 2018, 8:45 PM
AliRą«Æza
AliRą«Æza - avatar
+ 12
You could also write READABLE python programmes https://code.sololearn.com/cn5faURSpwLi/?ref=app
15th Apr 2018, 10:14 PM
Loeschzwerg
+ 10
14th Apr 2018, 2:51 AM
Naman
Naman - avatar