Page 1 of 1

A very strange equality

Posted: Thu Oct 08, 2009 4:56 pm
by livo
I'm probably not in the right forum place (sorry), but if I type in the message box :

Code: Select all

put  "0e363579" = "0e511970"
on my (Mac snow leopard) machine, the answer is "true".

Is there any - very strange - reason for that kind of mathematical miracle ?

Livo :-)

Posted: Thu Oct 08, 2009 6:36 pm
by bn
livo,

isn't 0 to the power of any number = 0?
That would explain why Rev returns true.
put "1e10" = "1e11"
returns false, apparently Rev evaluates the string and thinks it is a number and 0 equals 0
But I am on treacherous grounds here, math does not like me...

regards
Bernd

Posted: Thu Oct 08, 2009 10:17 pm
by mwieder
Right (on both counts: this isn't the right place to post this, and rev is evaluating the inputs as math).

If you're needing to see if two hex strings are the same value (that's my guess based on the two strings) then try prefacing them with some character that can't be evaluated as a hex digit. For example,

put "x" & "0e363579" = "x" & "0e511970"

Posted: Thu Oct 08, 2009 10:55 pm
by livo
Thank you both for this analysis, but this had nothing to do with any hex comparison (BTW will introduce some trouble with any hex value beginning wit "0E******")

I just wonder and try to understand WHY rev evaluates a simple ascii string as a mathematical exponentiation, and not with any of the other operators like {put "3+3" = "2*3"} or {put "0^8" = "0^88"}...

Anything with a number & "e" is evaluated as a number... and not as an alphanumerical string.

Posted: Thu Oct 08, 2009 11:30 pm
by Mark
I just wonder and try to understand WHY...
Because that's how xTalk languages work. Just get used to it. You will learn to appreciate it, I'm sure.

Best,

Mark

Posted: Sat Oct 10, 2009 2:32 am
by Mark Smith
My guess is that 0e36758 is a interpreted as a number, while "3*3" is an expression.

Best,

Mark Smith