multiple & divide

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Krysle
Newbie
Posts: 7
Joined: Thu Jan 15, 2009 10:34 pm
Location: United States
Contact:

multiple & divide

Post by Krysle » Tue Mar 17, 2009 1:52 pm

I need to be able to multiply and divide but macro scheduler doesn't seem to support those functions yet. Is there a way to do this?

Please note that I am a novice when it comes to this stuff.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 17, 2009 3:19 pm

Course it does! It has been dividing and multiplying since 1997! How do you think the calculator example that comes with the software works? :-)

//Divide 50 by 10:
Let>x=50/10

//Multiply 500 by 5
Let>y=500*5
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Krysle
Newbie
Posts: 7
Joined: Thu Jan 15, 2009 10:34 pm
Location: United States
Contact:

Post by Krysle » Tue Mar 17, 2009 6:01 pm

doh... I was looking at the arithmetic functions... tyvm

ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

Re: multiple & divide

Post by ABIVEN » Tue Nov 24, 2015 6:35 pm

For calculating

MACROSCHEDULER provides extended capabilities further than the basic 15 digits

- For a small time investment by mixing with a text application and an online Instant link* calculator [use the Record tool Image ]
- Alone by mixing numbers and strings
Just to know : Position> MidStr> Length> ConCat>
Thereafter a little slow macro giving for two integers the Product A*B [A 10-digits and B much more]

*Instant link : example : MACROSCHEDULER' message modal box allows Instant link via copy & paste ; processed by MS via Getclipboard> & Putclipboard>

/*
A Multiplicande integer up to 10-digits
B Multiplier integer having nbase digits nbase quasi illimited
Gives a Product P = A*B
B is broken down into n blocks [1] of exactly 5 digits B1 . . Bj . . Bn ,
eventually by adding some 0s [2]
These 0s would be deleted in the end [3] ; B has now 5*n digits.
Each B block gives *A a P block with exactly 5 digits [ except block 1]
and an adding ADD [ except block 1]
Each P block retrieves an adding ADD [ except block n]
Starts j=n ; ends j=1
*/
Let>DECIMAL_SEPARATOR=.
let>MSG_HEIGHT=500
let>MSG_WIDTH=800
message> This macro is for large integer B Enter B via clipboard ; if not already done do it now before A %CRLF%
wait>1.2

Input>A, A Multiplicande up to 10-digits integer
getclipboard>B

len>B,nbase
let>FOR1=0000000000
concat>B,FOR1
len>B,n
let>ns5=n/5
let>n={Trunc(%ns5%)}
let>n=n*5
MidStr>B,1,n,B
let>lensupp=n-nbase
let>n=n/5
//[1]Gives n number of blocks

let>j=n
let>ADD=0
While>j>0
let>m=5*j
let>m=m-4
let>FOR1=00000
midStr>B,m,5,Bj
let>Pj=%Bj%*A
let>Pj=Pj+ADD
LEN>Pj,lenPj
if>lenPj<5
let>lennew=lenPj+1
//[2]adding some 0s
concat>FOR1,Pj
let>Pj=FOR1
let>ADD=0
midStr>Pj,lennew,5,Pj
goto>termina
else
endif
let>lenPjm5=lenPj-5
let>lenPjm4=lenPj-4
if>lenPjm5<1
let>ADD=0
goto>termini
else
endif
if>j=1
goto>terminus
else
midStr>Pj,1,lenPjm5,ADD
label>termini
midStr>Pj,lenPjm4,5,Pj
let>ADD=ADD*1
endif
label>termina
if>j=n
let>P°=Pj
goto>suite
else
endif
label>terminus
concat>Pj,P°
let>P°=Pj
label>suite
len>P°,lenP°
let>j=j-1
Endwhile
let>lenresultat=lenP°-lensupp
MidStr>P°,1,lenresultat,P°
//[3]0s added deleted
mdl>Product P° %P°%

exit

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts