A string doesn't equal itself

Bill Marriott wjm at wjm.org
Tue Apr 10 07:54:35 EDT 2007


As I recall from high school, in scientific notation the whole part of a 
number expressed this way must be <=1 and <10.

Possibly a satisfactory enhancement would be to follow a stricter protocol 
for scientific notation... strings with a single "E" in them being a number 
if and only if they contain a decimal point after a single leading non-zero 
digit?

09114E715806 = text string
0.9114E715806 = text string
09.114E715806 = text string
9E715806 = text string (hm)

9.114E715806 = number

You could be even stricter by requiring it be an uppercase "E" with a + or - 
sign following.

9.114e715806 = text string
9.114E715806 = text string
9.1E715806 = text string
91.14E+715806 = text string

9.114E+715806 = number

If you are feeding the engine "9.114E+715806" it seems you couldn't really 
complain that it treats it as a number.

Of course, who knows what is built-in to math routines on modern systems vs. 
what is written in Rev, and what havoc this could play with performance. If 
implementing this made everything 2% slower in all situations, would you 
rather special case it on your own with the & null workaround?


"Mark Wieder" <mwieder at ahsoftware.net> wrote in 
message news:31425194497.20070409185037 at ahsoftware.net...
> Ken-
>
> Sunday, April 8, 2007, 11:00:24 PM, you wrote:
>
>> Just my 2 cents,
>
> I see your two and raise you a nickle. You're absolutely right about
> that. I went back and read it again. This looks quite buggy to me. IMO
> the quotes should prevent dereferencing and evaluation as a number.
> Yuck!
>
> Of possible interest is that the breakpoint is around 1.796931348E308:
>
> put "1.796931348E308" = "1.796931348E308"
>  returns true
> put "1.796931349E308" = "1.796931349E308"
>  returns false
>
> -- 
> -Mark Wieder
> mwieder at ahsoftware.net
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 






More information about the use-livecode mailing list