Re^2: Division of big integers
by NERDVANA (Priest) on Dec 31, 2024 at 21:47 UTC
|
| [reply] [d/l] |
|
|
| [reply] |
|
|
2025--
PS: Granted I'm bitching about a lot of stuff, but I don't think TinyPerl is part of it. That slot is taken by others. =)
I literally wanted to know if he's aware.
Even if he wants to reinvent this wheel for his tiny thingy, those modules are in Pure Perl, so "borrowing" code shouldn't be too hard. (If it's not already running out of the box)
| [reply] [d/l] |
|
|
NERDVANA, you are the wind beneath my wings.
| [reply] |
|
|
| [reply] |
|
|
I think, the conversation would have unfolded differently. But it's New Year's Eve, so let's party. Btw I haven't started learning Python yet. First I want to become a lot more familiar with Perl. I might learn Python one day, but I keep putting it off. Honestly, I hate its syntax.
| [reply] |
|
|
One thing I was maybe wrong about was BigInt not working for TinyPerl. I assumed it would need a .dll that didn't ship with TinyPerl, but LanX pointed out that Perl's Math::BigInt is in fact pure-perl, so you just need to put the 5.8 version of Math/BigInt.pm file (and maybe bigint.pm for the pragma) in your lib path and it might just work.
Part of my joke is that you have the full version of Python installed but only half of Perl installed... so you might reconsider your motivations for that some time. Yes Perl comes with a lot of bloat modules, but I wouldn't classify BigInt or BigFloat or BigRat as part of the "bloat".
| [reply] |
|
|
| [reply] |
|
|
Re^2: Division of big integers
by harangzsolt33 (Deacon) on Jan 01, 2025 at 04:29 UTC
|
Yes, I am aware. My goal is to write this in pure perl. The goal isn't necessarily to produce the smallest perl script possible but one that is easy to understand and does perform well considering it's written in pure perl. So, I am looking for such a solution. Remember, I am just a hobby programmer, which means I am not getting paid for the lines of code I write. And I am not getting paid by the hour or by the product I produce. It's entirely for entertainment and fun. So, with that in mind, I am trying to understand how to divide a big integer by another big integer, and this is quite tricky, because a big integer means it can be hundreds of digits long, so it's not going to fit into a regular perl number. Normally, perl numbers have 15 significant digits, and anything beyond that is lost because it has to fit into 64 bits. So, therefore, using regular numbers is out of the question, I guess. | [reply] |
|
|
These modules are pure Perl, that's why their performance is poor Perl. (SCNR)
You might learn a bit by looking into them. :)
Good luck!
PS: I seem to remember they had XS shadows, but my brain feels 2025 years old...
Update
Yep, multiple XS modules available, like Math::BigInt::GMP and Math::BigInt::FastCalc
syphilis might know better about the pro and cons
| [reply] |