|
sp000n Novice
Joined: 04 Jul 2001 Posts: 32
|
Posted: Sun Jun 02, 2002 3:06 am
Another day, another question: how big are var's? |
When Zmud multiplies 1073741824 by 2 for me, it gets -2147483648 (the negative value of the # I want). THEN, when I ask it to multiply that by 2, it gives 2. What gives and how do I get around it?
|
|
|
|
GiriFox Wanderer
Joined: 25 Sep 2001 Posts: 59 Location: Australia
|
Posted: Sun Jun 02, 2002 5:45 am |
I don't think v6.16 can handle long integers like that. It is looping.
Upgrade to latest version (beta) which can handle big numbers (and decimals too) or reduce the figures you're using by a factor of 1000 or so, then it will work. |
|
|
|
sp000n Novice
Joined: 04 Jul 2001 Posts: 32
|
Posted: Sun Jun 02, 2002 6:15 am |
This is the beta version (6.26) :(
Thanks, tho. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Jun 02, 2002 3:02 pm |
For those thing where I need to overcome the longint limitations and still have precision I have written the following.
#ALIAS ADDB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%numitems(@%1);#VAR %1 {%replaceitem(%eval(%number(%item(@%1,@TempBignumber))+%2), @TempBigNumber,@%1)};#WHILE (@TempBigNumber) { #IF (%number(%item(@%1,@TempBigNumber))>1000) {#IF (@TempBigNumber>1) {#VAR %1 {%replaceitem(%eval(%number(%item(@%1, %eval(@TempBigNumber-1)))+%number(%leftback(%item(@%1, @TempBignumber),3))),%eval(@TempBigNumber-1),@%1)};#VAR %1 {%replaceitem(%rightback(%item(@%1,@TempBignumber),3), @TempBigNumber,@%1)}} {#VAR %1 {%replaceitem(%concat(%leftback(%item(@%1,1),3), ":",%rightback(%item(@%1,1),3)),1,@%1)};#VAR %1 {%replace(@%1,":","|")}};#ADD TempBigNumber -1} { TempBigNumber=0}}}
#ALIAS DIVB {#IF (!%defined("%1")) {#ABORT 1};#IF (%number(%2)<1) {#ABORT 1};TempBigNumber=%concat(%eval(%number(%item(@%1,1))/%2),"|", %eval(%number(%item(@%1,1))%2),"|1");#WHILE (%item(@TempBigNumber,3)<%numitems(@%1)) {TempBigNumber=%replaceitem(%eval(%number(%item(@TempBigNumber,3))+1), 3,@TempBigNumber);TempBigNumber=%replaceitem(%concat(%item(@TempBigNumber,1), ":", %eval((%number(%item(@%1,%item(@TempBigNumber, 3)))+%eval(1000*%number(%item(@TempBigNumber, 2))))/%2)),1,@TempBigNumber);TempBigNumber=%replaceitem(%mod((%number(%item(@%1, %item(@TempBigNumber,3)))+%eval(1000*%number(%item(@TempBigNumber, 2)))),%2),2,@TempBigNumber)};#VAR %1 {%replace(%item(@TempBigNumber,1),":","|")}}
#ALIAS SHOB {#IF (!%defined("%1")) {#ABORT 1};TempBigNumber="";#FORALL @%1 { TempBigNumber=%concat(@TempBigNumber,%replace(%format("&3.0f",%i)," ","0"))};#WHILE (%left(@TempBigNumber,1)="0") { TempBigNumber=%right(@TempBigNumber,1)};#VAR %1 @TempBigNumber}
Sadly I didn't write a multiply, but it shouldn't be that hard. Also the ADDB doesn't take negative numbers, I didn't need it to so I didn't bother. |
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|