April 16, 2024, 04:16:14 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Working with strings

Started by Andy, December 25, 2015, 11:16:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

Well, I've looked at multiplying two numbers together 'till I'm seeing numbers in my sleep.

So - would some one please double check me.

I'm sure this is correct now, but I need some feedback please.....

Attached is the new beta version of StringMap6, and I'm focusing on the multiplication function.

To that end, I have attached all the files needed.

Please unzip the files, copy the lib file to the IWBDev libs folder, and compile m2.iwb

Please change the numbers in the strings - Xstring1 and Xstring3 to other numbers.

Please let me know how you get on.....

WARNING! - for very large numbers - be prepared for a wait! - I will try to optimise this later.

Please remember - I cannot use INT, VAL, +, -, * commands normally, so I have to do this in little bite size peices and use my own addition function as the numbers get to large for IWB.

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

February 11, 2016, 11:56:10 PM #51 Last Edit: February 12, 2016, 11:53:23 PM by andy1966
These are the timings for calculations using my multiplication function and vary a little depending on what my pc is doing:

(Length of number 1 x Length of number 2)

70 x 70 = 918765.89 ms = 15.3 mins
60 x 60 = 509163.67 ms = 8.48
50 x 50 = 256304.41 ms = 4.26
40 x 40 = 110279.48 ms = 1.83
30 x 30 = 39009.83  ms = 0.65
20 x 20 = 9683.33   ms = 0.16
10 x 10 = 1095.2    ms = 0.0185
5  x 5  = 115.75    ms = 0.00191

As you can see, the timing jumps everytime you add another 10 x 10 digits, and I would estimate 100 x 100 digits multiplied would take around 59 mins (I've tried it since posting this).

These timings are done on my older PC, and I'm sure many of you will have faster machines than mine.

I used Graham's (GWS) precision timing routine to get these results (thanks Graham).

Limits:
Well, at the moment it would be around 500 x 500 (or 1,000) digits in total that can be multiplied.

It works with numbers that have decimal places in them, also the numbers can be positive or negative.

Like I said before, if you have a large number and you can wait, then the multiplication function will work for you. If you cannot wait, then you'll have to find another solution.

I've done my best! - attached is a typical screenshot.





Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

February 17, 2016, 07:16:37 AM #52 Last Edit: February 17, 2016, 07:18:37 AM by andy1966
Okay,

I've now cracked division of a large number by another large number and you can specify the number of decimal places you require and it is very very accurate.

I have had to "go back to school" with division, and I've watched a lot of childrens online maths videos to check myself - It's amazing what you remember (and what you don't!).

I just need to work on division of numbers with decimals in them - but this should be a small point now.

Also, I've added the functions - SMLessThan, SMGreaterThan, SMEquals, SMPower10 functions which I needed to complete the division subroutine.

Hopefully now, I can complete my StringMap 6 release soon.

Division has been a tough one I can tell you!!

Thanks for reading this,

Andy.




Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Hi,

As far as I can see now, division of large numbers (and small of course) is working!

Attached is the zip file that has all files needed.

Please copy the lib file to your IWBDev / Libs folder and compile and run div1.iwb.

Please change the numbers in the two strings - String11 and String21 to test.

I will document the help file as soon as I can and make a full release of StringMap6.

Please let me know how you get on....

P.S. - Division has been a real so and so to do!

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Just running through the numbers for division,

It looks like I have a little more work to do to finish of division, I now need to look at numbers that have 0.00something in them and adjust the decimal point accordingly.

Just thought I'd mention it (before someone else did!).

However, I did try dividing a 160 digit number by another 160 digit number and it took only a couple of seconds to do, so I'm very pleased with the speed of division.

I have also added functions to strip of leading and trailing zeros if needed.

Anyway, must crack on with these very small numbers.

Thanks,
Andy.
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.

Andy

Hi,

Here is the new StringMap update - this is the new full release.

It's taken some work I can tell you!

Now there are 254 functions available, including the division function.

Attached are all the files you need including some iwb source programs for you to compile and play around with.

Unzip all files, copy the .lib file to your IWBDev / libs folder and you can compile the programs to have a look.

As always, please have a read of the help file first!!

Thanks,
Andy.
:)
Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.