That's a good idea, thank you. It seems to work quite nicely up to a point, as in, 34 digits. But after that, it appears to start rounding.. but it's a great proof of concept. I'll tweak it a bit and get it to do right (using a while loop, of course). Thanks for your help, it's very much appreciated.
EDIT: One issue with this approach is how it handles zeros when they're at the start of a 17-character "block". I'm currently making a way to work around this, though, and I'll post what I come up with in here when I think I'm done in case anyone else wants the script.
EDIT AGAIN: Here's the code I came up with. It seems to perform well under my tests.. I haven't found a flaw with it. At least with division, which is all I tested it with. [EDIT: it only works with division..][Another EDIT: it has a flaw involving ones at the start of 17-character blocks.] I'm also including an identifier I wrote, since it makes the script itself look much more.. clean, without having to do that in the main script.
alias Lcalc {
;SYNTAX: $Lcalc(number,operator,smallernumber)
;Example, $Lcalc(64,/,2) returns 32.
if ($len($3) < 17) {
var %step = 1
while ($mid($1,$calc((%step - 1) * 17)) != $null) { var %cur = $mid($1,$calc((%step - 1) * 17 + 1),17) | if ((!$remove(%cur,0)) && ($len(%cur > 1))) { var %lcalc.b = %cur } | else { var %lcalc.b = %cur $2 $3 | var %lcalc.b = $str(0,$countleft(%cur,0)) $+ %lcalc.b } | var %lcalc.t = %lcalc.t $+ %lcalc.b | inc %step }
return %lcalc.t
}
}
alias countleft {
;SYNTAX: $countleft(text,character)
;The number of "character" on the left side of text is counted and returned.
;Example: $countleft(hhhithere,h) would return 3.
;You can put a - next to 'character' to count from the right. Example, $countleft(hhhithere,-e) would return 1.
var %step = 1 , %ident = $iif($left($2,1) == -,$iif($len($2) == 2,right),left) $+ $chr(40) $+ z $+ $chr(41) , %2 = $iif($len($2) == 2,$right($2,1),$left($2,1))
while ($ [ $+ [ $replace(%ident,z,$1 $+ $chr(44) $+ %step) ] ] == $str(%2,%step)) inc %step
return $calc(%step - 1)
}
Note I changed it from Pcalc to Lcalc, to avoid confusion and because "loop" starts with "L".
Since the script appears full of holes, anyone who wants to try to fix it (or provide their own script as a replacement) can feel free. :P
Thank you.
Listen to this lol <<< btw not mean way
I would write the whole script which would be lenghty the reason why I say lenghty is because studying the blocks of 17 max calcs per operation would require this method a division script alone, multiplication,Substraction and addition script alone, therefore there would be 4 Operators that would need to be scripted individual why I say this.. EX:...
this is a short re-code i did so that the lenght of $1 works weither it be over 34 chars MAX: 52 for this script. Also it wont work if charges are less then 34 due to my IF (%lc.c) check meaning only if %lc.c is present.. ""More if statement can be added"
alias newc {
if ($len($1)) { %lc.a = $left($1,+17) | %lc.b = $left($remove($1,%lc.a),+17) | %ts.a = $+(%lc.a,%lc.b) | %lc.c = $left($remove($1,%ts.a),+17) }
IF (!%lc.c) { unset %lc.c }
if (!%lc.b) { unset %lc.b }
}
alias lcalc {
newc $1
if (%lc.c) { %lc.a = %lc.a $2 $3 | %lc.b = %lc.b $2 $3 | %lc.c = %lc.c $2 $3 | return $+(%lc.a,%lc.b,%lc.c) }
}
Here we go
Dividing by 2 would make the script rather easy hwoever what happens when we divide by 100?
$lcalc(1396424641746417249012204916221048172117162676176,/,100)
returns
139642464174641.72490122049162210.51721171626761.76
Notice all the decimal points, now my method of approach to remove the decimal points would be to remove and store them to a temp var example .72 < i would "$remove(x,.72)" and store it in var I would do the same for all decimal points. this way in the end you can calc the decimal points and re-add them to the end of the valued return. if example I would put $calc(.72+.51+.76) which the result would be 1.99 so at the end of this result in question it would be 6762.99 in theory right?
See my scenario if not ill try to explain it again. There's a requirement for * / + - in each of their own scenarios that cannot be made by a single written script for all four vars, I mean
if ($2 == /) for example if you use that method then it will be in "one" script but I mean you need 4 seperate events.
Really if you got alot of time on your hands knock yourself out. You seem to know and understand what I mean so hope this helps out for you.
Ill check back later if you have a question I like math to an extent...