Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias nre { return -?((\d|\x2C)+?(!|\.\d+?)?(x|y)?|\.\d+?(x|y)?) }
- alias mnre { return (x|y|pi|(?-i)e|(?-i)G| $+ $nre $+ (t(ril)?|b(il)?|m(il)?|k)?) }
- alias mcre { return (\+|-|\*|\/|\^|\%) }
- alias mathre {
- var %x
- .fopen formula txt/formula.txt
- while ($fread(formula)) {
- %x = $addtok(%x,$gettok($v1,1,9),124)
- }
- .fclose formula
- return ( $+ %x $+ )
- }
- on $*:text:$(/^(\x28*( $mathre \x5B)*\x28* $mnre \x5D*(\s? $mcre \s?\x28*( $mathre \x5B)*\x28* $mnre (\x5D|\x29)*)+?|( $mathre \x5B) $mnre \x5D*)(\sbase\s?([1-9]|[1-2][0-9]|[3][0-6]))?(\x2C?\s(x|y|z)\s?\=\s? $nre |\s?\=\s?-?((\d|\x2C)+?(!|\.\d+?)?|\.\d+?))*$/ix):#:{
- tokenize 32 $numconv($.replace($regsubex($regsubex($1-,/(\d+)(\!)/g,factorial[ $+ \1 $+ ]),/(\d)(x|y|z)/ig,\1 * \2),/pi/g,$pi,/(?<=^|\W|\+|-|\*|\/|\^|\%)e/g,2.71828182845904523536,/(?<=^|\W|\+|-|\*|\/|\^|\%)G/g,0.915965594177219015054,$chr(44),$null))
- var %x = $1-, %r
- if ($count($1-,$chr(40)) != $count($1-,$chr(41))) || ($count($1-,$chr(91)) != $count($1-,$chr(93))) {
- msg $chan Invalid input: Mismatched brackets.
- return
- }
- else {
- while ($regex(var,%x,/(?<![a-z])(x|y|z)(?!\s?\=)/i)) {
- if (!$regex(%x,/ $regml(var,1) \=/ix)) {
- msg $chan solving isnt done yet
- return
- }
- noop $regex(r,%x,/ $regml(var,1) \=(\d+(\.\d+)?|\.\d+)/igx)
- %x = $regsubex(%x,/((?<![a-z]) $regml(var,1) (?!\=))/igx,$regml(r,1))
- }
- }
- while ($chr(91) isin %x) { %x = $regsubex(%x,/([a-z]+\[[^\[|\]]+\])/i,$mfunc(\1)) }
- if ($regex(%x,/\sbase\s?([1-9]|[1-2][0-9]|[3][0-6])$/)) { msg $chan $base($calc(%x),10,$regml(1)) }
- else { msg $chan $bytes($calc(%x),bd) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement