1 guest2 27-Mar-2007 17:16 Edited: guest2 27-Mar-2007 17:19 | hello
i had a look on your script.
yes it works, but it is very slow even if the code was optimized.
there is better ways, search on Internet for some good theories:
and have a look on what follows:
[code]
mul: func [n1 n2 /local tmp res len a b c d][
; n1 * n2 can be decomposed in four numbers, following the formula
(a + b) * (c + d).
; The goal is to decompose them into smaller numbers (recursivly)
until we can use the native mult operation
; of rebol.
; Then, the big number is rebuild by addition and concatenation of
intermediate results.
len: max length? n1 length? n2
if len < 5 [return to string! (to integer! n1) * to integer! n2]
res: cp ""
if 0 = len: min 4 min length? n1 length? n2 [return ""]
a: cp/part n1 (length? n1) - len
b: at n1 (length? n1) - len + 1
c: cp/part n2 (length? n2) - len
d: at n2 (length? n2) - len + 1
res: mul b d
tmp: add mul a d mul c b
either len < length? res [tmp: add tmp cp/part res (length? res)
- len][insert/dup res "0" len - length? res]
res: append tmp at res (length? res) - len + 1
tmp: mul a c
len: len * 2
either len < length? res [tmp: add tmp cp/part res (length? res)
- len][insert/dup res "0" len - length? res]
append tmp at res (length? res) - len + 1
]
add: func [n1 n2 /local len tmp res a b c d][
; same as above, n1 and n2 are decomposed in smaller numbers, recursivly
until Rebol can operate them nativly.
if 10 > max length? n1 length? n2 [return to string! (to integer!
n1) + to integer! n2]
if 0 = len: min 9 min length? n1 length? n2 [return either empty?
n1 [n2][n1]]
a: cp/part n1 (length? n1) - len
b: at n1 (length? n1) - len + 1
c: cp/part n2 (length? n2) - len
d: at n2 (length? n2) - len + 1
res: add b d
tmp: add a c
either len < length? res [tmp: add tmp "1" remove res][insert/dup
res "0" len - length? res]
append tmp res
]
[/code] |
|
2 johnsjvi95 24-May-2021 3:31 | |
|
3 narinder 22-Oct-2021 3:40 | |
|
4 mark214 20-Nov-2021 19:46 | |
|
5 marosol 10-Dec-2021 1:51 | |
|
6 crutcherhuyn 28-Feb-2022 20:21 | |
|
7 marie 16-Mar-2022 8:24 | |
|
8 johnsjvi95 8-Apr-2022 22:20 | |
|
9 joeanderson 11-Apr-2022 16:33 | |
|
10 ampva301 21-Jun-2022 19:21 | I am new to this industry and am having difficulty with some scripts. Thank you for bringing this to our attention. I appreciate it really. https://www.drywallproscleveland.com |
|
11 janwil 19-Jul-2022 11:06 | |
|
12 johnsjvi95 22-Jul-2022 6:17 | |
|
13 madelsmith 26-Jul-2022 1:33 | |
|
14 saruonhosari 17-Aug-2022 0:31 |
 |
We also offer many different services, including semi truck engine repair, commercial truck suspension repair, air conditioning service, semi trick air brake service, and many more.
Contents:
A/C Repair Service milwaukee
|
 |
MakeDoc2 by REBOL- 17-Aug-2022
|
|
|
15 frances1234 22-Aug-2022 21:20 |
 |
If you're getting a NA result from the preceding line, turning off scientific notation may help spin the wheel. The command to use for this is "base options."
Contents:
|
 |
MakeDoc2 by REBOL- 22-Aug-2022
|
|
|
16 ficode 21-Nov-2022 3:33 | |
|
17 mandiripinja 5-Dec-2022 7:50 | pinjaman dana jaminan bpkb mobil cepat hanya 1 hari bisa langsung cair dengan suku bunga rendah serta tanpa survey dan bpkb mobil aman untuk seluruh wilayah indonesia. https://www.justgiving.com/fundraising/mandiripinjamandana https://ameblo.jp/mandiripinjamandana/entry-12680765607.html https://ameblo.jp/mandiripinjamandana/entry-12680767540.html https://ameblo.jp/mandiripinjamandana/entry-12680769727.html https://ameblo.jp/mandiripinjamandana/entry-12680770493.html https://ameblo.jp/mandiripinjamandana/entry-12680771364.html https://ameblo.jp/mandiripinjamandana/entry-12680785558.html https://ameblo.jp/mandiripinjamandana/entry-12680786359.html https://ameblo.jp/mandiripinjamandana/entry-12680787122.html https://ameblo.jp/mandiripinjamandana/entry-12680787855.html https://ameblo.jp/mandiripinjamandana/entry-12680788647.html https://ameblo.jp/mandiripinjamandana/entry-12680789550.html https://ameblo.jp/mandiripinjamandana/entry-12680790188.html https://ameblo.jp/mandiripinjamandana/entry-12680790735.html https://ameblo.jp/mandiripinjamandana/entry-12680791419.html https://ameblo.jp/mandiripinjamandana/entry-12680792163.html https://ameblo.jp/mandiripinjamandana/entry-12680792608.html https://ameblo.jp/mandiripinjamandana/entry-12680793459.html https://ameblo.jp/mandiripinjamandana/entry-12680793916.html https://ameblo.jp/mandiripinjamandana/entry-12680794272.html https://ameblo.jp/mandiripinjamandana/entry-12680794619.html https://ameblo.jp/mandiripinjamandana/entry-12680794959.html https://ameblo.jp/mandiripinjamandana/entry-12680795284.html https://ameblo.jp/mandiripinjamandana/entry-12680795637.html |
|
18 crutcherhuyn 20-Dec-2022 22:37 | |
|
19 emmausa 14-Feb-2023 0:03 | Your post's format is amazing and engaging! I appreciate how valuable and instructive it is, and I look forward to your next message. https://krunkergame.co |
|
20 wellwell38 20-Feb-2023 2:24 Edited: wellwell38 20-Feb-2023 2:26 | The information you share is very good so I am very curious about your next posts. https://lolbeans-io.com/ |
|
21 johnsjvi95 13-Mar-2023 7:06 |
 |
We are dedicated to keeping your car on the road and running smoothly, and we will always go above and beyond to make sure you are satisfied with the work we do.
Contents:
Cedar Park Towing Company
|
 |
MakeDoc2 by REBOL- 13-Mar-2023
|
|
|
22 crutcherhuyn 13-Mar-2023 17:36 | |
|
23 blythewoody 1-Apr-2023 1:32 |
 |
Hello! It's great to hear that you've reviewed the script and found it functional, but you're right that there may be more efficient algorithms out there for performing multiplication and addition of large numbers.
Contents:
The code you've provided is implementing a recursive approach to decomposing the numbers into smaller pieces that can be handled natively by Rebol. This is a common technique used in large number arithmetic, and can certainly be more efficient than straightforward long multiplication or addition algorithms.
However, it's worth noting that there are many existing libraries and modules for handling large number arithmetic in a variety of programming languages, which may be more efficient and thoroughly tested than rolling your own implementation.
That being said, if you're interested in exploring more efficient algorithms for large-number arithmetic, I would recommend starting with some research into the Karatsuba algorithm and the Toom-Cook algorithm. These are both widely-used techniques for multiplying large numbers that can be more efficient than traditional long multiplication.
I hope this helps! Let me know if you have any further questions. Cincinnati SEO expert
|
 |
MakeDoc2 by REBOL- 1-Apr-2023
|
|
|
24 madelsmith 5-Apr-2023 5:39 |
 |
Thank you for the suggestion! However, I would like to clarify that the code I provided was not intended to be an optimized solution for multiplication, but rather a simple example of how to implement a multiplication function using recursion in Python.
Contents:
That being said, I appreciate your code and I believe it could be helpful for those looking for a more optimized solution for multiplication. Realtors in Miami
|
 |
MakeDoc2 by REBOL- 5-Apr-2023
|
|
|
25 miyaka22 29-Feb-2024 0:09 |
 |
We are your go-to choice for all of your needs in the plumbing and HVAC industries because of our versatility, which enables us to provide a wide range of these services.
Contents:
www.jimmygusky.com/about-us
|
 |
MakeDoc2 by REBOL- 29-Feb-2024
|
|
|
26 annafaaster 8-May-2024 6:09 |
Probably every person who is interested in their health has at least
once heard such a phrase as ‘hormonal optimisation’. After all,
hormones are very important in any person's body. I found a great
article on this https://ways2well.com/blog/what-is-hormone-optimization-understanding-the-basics-and-beyond
site where I learned about what hormone optimisation is. Thanks to
this information, I understood what hormonal imbalance is and what
hormonal optimisation is for. I think this information can be helpful
to many people. Read this information on the website if you want
to know more about hormonal optimisation. |
|
27 angel17 4-Oct-2024 1:01 | Great post. I like this one! enclosure screen Wesley Chapel FL |
|
28 miyaka22 2-Mar 22:52 |
 |
No matter what type of vehicle you drive, we have the knowledge and expertise to get it running smoothly again.
Contents:
Mobile Mechanics
|
 |
MakeDoc2 by REBOL- 2-Mar-2025
|
|
|
29 musicalkanya 5-Mar 23:40 Edited: musicalkanya 5-Mar 23:41 |
Papa's Pizzeria: More Than Just a Game – It's a Culinary Masterpiece
for Your Eyes (and Stomach!) 🍕
Let's be real, who doesn't love pizza? But what if you could experience
the joy of crafting the perfect pie without any of the mess? Enter
Papa's Pizzeria, a game so visually stunning and satisfying that
it transcends mere entertainment – it becomes an art form.
A Feast for the Senses 🎨
From the very first swirl of sauce to the satisfied grin on a customer's
face, every moment in Papa's Pizzeria is designed to delight your
senses. Forget bland graphics and repetitive gameplay; this is a
vibrant, detailed world where every ingredient looks good enough
to eat.
The Palette of Pizza Perfection: Imagine plump, juicy tomatoes simmering
into a rich sauce, waiting to be spread across a perfectly round
canvas of dough. Picture fresh basil leaves, vibrant green bell peppers,
and perfectly sliced mushrooms ready to be strategically placed.
Each topping is a brushstroke, waiting for your creative touch.
The Alchemy of the Oven: The transformation that happens inside the
oven is pure magic. Watch as the cheese melts into a bubbly, golden
blanket. See the crust rise and turn a crispy, mouthwatering brown.
The anticipation is almost unbearable!
Slicing Satisfaction: And then comes the most satisfying moment of
all: slicing your masterpiece. Each cut is clean and precise, revealing
the layers of deliciousness within. It's a visual reward that keeps
you coming back for more.
More Than Just Eye Candy
But Papa's Pizzeria is more than just a pretty face. The colorful,
detailed graphics enhance the gameplay, making every action feel
meaningful and rewarding.
Strategic Visual Cues: The game uses visual cues to guide your decisions.
The bubbling of the cheese tells you when your pizza is perfectly baked. The placement of toppings helps you balance flavors and textures.
A Symphony of Sounds: The sizzle of the oven, the satisfying thwack
of the pizza cutter, the happy chatter of customers – every sound
is carefully crafted to immerse you in the experience.
Warning: May Cause Extreme Pizza Cravings!
The only downside to ]Papa's Pizzeria ? It will make you crave pizza
like never before. You might find yourself suddenly obsessed with
perfecting your own homemade pies, or at the very least, ordering
takeout on a regular basis.
Ready to Embrace the Pizza Life?
So, are you ready to embark on a culinary adventure that will tantalize
your taste buds and delight your eyes? Put on your virtual apron,
fire up the oven, and prepare to become a pizza-making artist.
Don't say we didn't warn you – side effects may include uncontrollable
cravings, increased pizza consumption, and an overwhelming desire
to open your own real-life pizzeria! 🍕👨🍳✨
P.S. Have your favorite pizza delivery app ready. Trust us. 😉 |
|