on 2/4/02 4:35 AM, Sarah Reichelt at [EMAIL PROTECTED] wrote:
> I don't know if this will help, but in HyperCard, direct string
> comparisons don't show up differences in case.
> e.g. "HyperCard" = "hyPERcard" gives true.
>
> The solution was to use 2 comparisons, a greater than and a less than:
>
> if string1 < string2 or string1 > string2 then answer "Different"
> else answer "The same."
>
> Perhaps this technique would work for you as well as it won't care that
> some of your comparisons are numeric.
Sarah,
Thanks for this - it's an interesting technique for case-sensitive
comparisons in HyperCard (I didn't know about it) but it doesn't actually
work in Revolution. It appears that when Rev compares two strings which
differ in case, "=" operator returns true, both "<" and ">" return false
(which I think is consistent - arguably the effect in HC should have been
regarded as a bug).
In the case that I was reporting, however, Revolution turns out to be less
consistent. The problem is that two strings which are supposed to be of hex
digits (and should therefore appear to Rev as strings) if it happens that
the only non-decimal digit appearing is a single 'e', Revolution interprets
them as numbers in 'scientific' notation, and if the part after 'e' is
sufficiently large, this makes numbers that Rev knows it can't handle
accurately. In this case comparing two such identical strings for equality
returns false. I said in my original post that I thought it was arguable
that this was a feature, not a bug - Rev knew that the two strings
represented two numbers which it couldn't handle accurately, so it didn't
commit itself on their being the same.
Following your post however, I checked with "<" and ">" - which produces the
very weird result that
("1E2345" = "1E2345") --> false
("1E2345" < "1E2345") --> false
("1E2345" > "1E2345") --> true
Ben Rubinstein | Email: [EMAIL PROTECTED]
Cognitive Applications Ltd | Phone: +44 (0)1273-821600
http://www.cogapp.com | Fax : +44 (0)1273-728866
_______________________________________________
improve-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/improve-revolution