I just started playing with SmartBat and I found the Evaluate
function. So, to get a feel for things, I tried a few expressions:

2+4       = 6     (Okay)
2*4       = 8     (Looking good...)
5^2       = 7     (What!?! 5 squared is 25. Wait a minute. What if...)
1^1       = 0     (Yup! It's XORing not raising to a power.)
1|2       = 3     (And this is OR)
1|2|4     = 7     (So it this)
7&1       = 1     (This is AND)
4&1       = 0     (So it this)
5**2      = 25    (That's better!)
2*5**2    = 100   (Hunh? It should be 50.)
2*(5**25) = 50    (Ah! A problem with the order of operations.)
sqrt(25)  = Error (No sqrt [square root] function? Oh well...)
25**.5    = 5     (I know how to get around that problem!)

Everything seems to make sense (after I got over the binary math)
except this:
2*5**2    = 100   (Hunh? It should be 50.)

This seemed to be evaluated as:
(2*5)**2
(10)**2
100
and not
2*(5**2)
2*(25)
100

If I remember correctly, in the order of operations (PEMDAS),
exponentiation comes after parentheses and before multiplication and
division, which come before addition and subtraction.

So, is this a problem with SmartBat's Evaluate function, the %CALC
macro, the library (if any) RitLabs used to implement this
functionality, or my memory?

-- 
Chris
Quoting when replying to this message is good for your karma.

A day without sunshine is like, night.

Using The Bat! v2.02.3 CE on Windows XP 5.1 Build 2600 Service Pack 1

Attachment: pgp00000.pgp
Description: PGP signature

________________________________________________
Current version is 2.02.3 CE | "Using TBUDL" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to