## Re: [Clip] isnumber function

Expand Messages
• ... Except if it s a single letter! :-) ... It works, as I can use both period and comma. The problem is that a single alphabetic character returns true when
Message 1 of 22 , Mar 8, 2006
• 0 Attachment
Larry Hamilton wrote:
>The IsNumber function is a True/False test. Either the selected
>information is a number or it is not.

Except if it's a single letter! :-)

>I have not tested region-specific delimiters for thousands and decimals,
>but it should rely on the regional settings to determine if certain
>values are numbers or not. If it does not fit the pattern for thousands
>and decimals, then it must be a problem with the infamous input control.

It works, as I can use both period and comma.

The problem is that a single alphabetic character returns true when tested
with \$IsNumber\$, as Don discovered. What more is, the letter seems to
evaluate to 0. Or that's what we thought yesterday. But I tried to
calculate with all the letters in the alphabet and it turns out this only
"works" with the letters a, b, c, d, e, t, x and y. The others return an
error, as we expected they all would ("expression could not be evaluated").
But it doesn't stop here. Take a look at this. Just calculate with Ctrl+E,
no clip needed.

a*2=0
b*2=0
c*2=0
d*2=0
e*2=0
t*2=0
x*2=0
y*2=0

2^a=1
2^b=1
2^c=1
2^d=1
2^e=1
2^t=1
2^x=1
2^y=1

The letters act as they were zero. But look what happens with e here...

a+2=2
b+2=2
c+2=2
d+2=2
e+2=0
t+2=2
x+2=2
y+2=2

a-2=-2
b-2=-2
c-2=-2
d-2=-2
e-2=0
t-2=-2
x-2=-2
y-2=-2

??????????????
Lotta
• As we all know, the letter e is the most popular letter, so it demands to be treated differently during negotiations, don t you think?
Message 2 of 22 , Mar 8, 2006
• 0 Attachment
As we all know, the letter e is the most popular letter, so it demands
to be treated differently during negotiations, don't you think?

> The letters act as they were zero. But look what happens with e here...
>
>
> a+2=2
> b+2=2
> c+2=2
> d+2=2
> e+2=0
> t+2=2
> x+2=2
> y+2=2
>
> a-2=-2
> b-2=-2
> c-2=-2
> d-2=-2
> e-2=0
> t-2=-2
> x-2=-2
> y-2=-2
• ... I think it s nothing less than an insult that I can t calculate with å, ä and ö, that s what I think. I ll probably write to Jody about this. I demand
Message 3 of 22 , Mar 8, 2006
• 0 Attachment
Don wrote:
>As we all know, the letter e is the most popular letter, so it demands
>to be treated differently during negotiations, don't you think?

I think it's nothing less than an insult that I can't calculate with å, ä
demand that åäö calculation will be properly implemented in the next version!

Lotta - who is joking (better add that! ;-o))
• ... I d like to buy a Q. ;-) I do not know if this behavior for IsNumber is a clip language bug or a problem with the infamous input control. I do not need
Message 4 of 22 , Mar 8, 2006
• 0 Attachment
Don - htmlfixit.com wrote:
> As we all know, the letter e is the most popular letter, so it demands
> to be treated differently during negotiations, don't you think?
I'd like to buy a Q. ;-)

I do not know if this behavior for IsNumber is a clip language bug or a
problem with the infamous input control. I do not need this function too
often, so personally not a big problem, but it should be fixed.

Larry
• ... I think the problem is with the definition of IsNumber in Help. It takes an argument of Value and then refers to Value as the specified text . A
Message 5 of 22 , Mar 8, 2006
• 0 Attachment
Don - htmlfixit.com wrote:

> Larry Hamilton wrote:
> > loro wrote:
> >
> >>It's odd though. I also feel that what's not numeric should be
> alpha. And
> >>did we figure out why letters, mathematically, are zero? ;-o)
> >>
> >>Lotta
> >
> > Lotta,
> >
> > The IsNumber function is a True/False test. Either the selected
> > information is a number or it is not. The Clip Help indicates that it
> > returns 1 for a number and 0 if it is not. It must assume decimal
> > numbers, there is no option to consider Hexadecimal. But octal and
>
> Hi Larry,
>
> Of the things we tested only the following were numbers (according to
> isnumber):
> a. an integer
> b. any single letter of the alphabet (I consider this to be a bug)
>
> The following were not numbers:
> a. any decimal number
> b. any mixed characters other than a single alphabetic character
> c. any number with commas in it for example 1,000
>
> So isnumber isn't isnumber, it is isinteger (with an odd twist of single
> alphabetic characters tossed in).

I think the problem is with the definition of IsNumber in Help. It
takes an argument of "Value" and then refers to "Value" as the
"specified text". A better definition might be:

\$IsNumber*("Str")\$ *Returns 1 if Str contains only digits 0 through 9,
and 0 if it does not.

This explains what you observe. The fact that these numbers are
integers is just a coincidence. This definition also corresponds more
closely to the definition of IsAlpha.

It also might have avoided this whole thread. :-)

> Hopefully this can be fixed in version 4.96.
>
>
> Fookes Software: http://www.fookes.us, http://www.fookes.com
> Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
• ... Your definition would have indeed been better than the one provided ... but I think it is more accurate to say integers (defined as all whole numbers
Message 6 of 22 , Mar 9, 2006
• 0 Attachment
> I think the problem is with the definition of IsNumber in Help. It
> takes an argument of "Value" and then refers to "Value" as the
> "specified text". A better definition might be:
>
> \$IsNumber*("Str")\$ *Returns 1 if Str contains only digits 0 through 9,
> and 0 if it does not.
>
> This explains what you observe. The fact that these numbers are
> integers is just a coincidence. This definition also corresponds more
> closely to the definition of IsAlpha.
>
> It also might have avoided this whole thread. :-)

Your definition would have indeed been better than the one provided ...
but I think it is more accurate to say integers (defined as all whole
numbers positive AND NEGATIVE and zero:
http://en.wikipedia.org/wiki/Integer ). Your definition forgot the
negative sign ... that is not a 0-9 character ... and can only appear
immediately preceeding the number:
^!Info [C] minus 5 -- ^\$IsNumber("-5")\$
^!Info [C] 5 minus -- ^\$IsNumber("5-")\$
^!Info [C] 5 minus 5 -- ^\$IsNumber("5-5")\$

This tread would have still been necessary because what I needed to do
was test if something was a number in this format ([brackets mean
optional] and ... ellipses means one or more):
[#...][,][##]#[.][#...]

As isnumber didn't cover my situation ... I had to come up with a way to
do it.

Is is possible to test if something is a "number" with a regex?

Rules:
1. either one or no decimal point, but there can be any number of proper
characters before and after the decimal
2. comma's are permitted but not required, but may only be present with
three proper characters to the right of each comma and left of the
decimal (or implied decimal if it is an integer)
3. proper characters are 0-9, an no other characters are permitted
except for rule 1 (decimal point) and rule 2 (properly placed commas)

I wrote a clip function to do it, but if there is a regex that would do
it quicker ...

I just did this:
a+b+c+d+e+t+x+y=0
But the fact that those letters for some reason have a numeric value of
zero when used in calculations DOES NOT make them numbers per isnumber
when not used in calculations, as each of the following tests negative:
^!Info [C]abcdetxy --^\$IsNumber("abcdetxy")\$
^!Info [C]a --^\$IsNumber("a")\$
^!Info [C]aa --^\$IsNumber("aa")\$
^!Info [C]e --^\$IsNumber("e")\$

But when we use calc, we are all over the place ...
^!Info [C]abcdetxy --^\$IsNumber("^\$Calc(abcdetxy)\$")\$
^!Info [C]a --^\$IsNumber("^\$Calc(a)\$")\$
^!Info [C]aa --^\$IsNumber("^\$Calc(aa)\$")\$
^!Info [C]a*a --^\$IsNumber("^\$Calc(a*a)\$")\$
^!Info [C]e --^\$IsNumber("^\$Calc(e)\$")\$

Anyway, I am enjoying the tread and hope deep in my heart that this bug
just might be the catalyst to get Eric coding either an update or better
yet, a version 5. As I said a few months back though, I am not sure a
version 5 is really going to happen and nobody has told me I am wrong by
giving me any milestones, targets or goals. I'd settle for 4.96 with
this bug fixed and isnumber better defined in help ;-)
• Don, You could try this... It fetches 4.96 as well as 5.0. And: 123,4234,976.345 4234,976.345 234,976.345 4234976.345 4234976345 1 ( d+,)* d+( .)* d* Hugo
Message 7 of 22 , Mar 9, 2006
• 0 Attachment
Don,

You could try this...

It fetches 4.96 as well as 5.0.

And:
123,4234,976.345
4234,976.345
234,976.345
4234976.345
4234976345
1

(\d+,)*\d+(\.)*\d*

Hugo
• Hi Lotta and All, ... LOL! Actually, I have been trying to follow this thread, but my time is limited. I have sent posts to me to file it as a bug. I m sure
Message 8 of 22 , Mar 9, 2006
• 0 Attachment
Hi Lotta and All,

>Don wrote:
>> As we all know, the letter e is the most popular letter, so it
>> demands to be treated differently during negotiations, don't
>> you think?
>
>I think it's nothing less than an insult that I can't calculate
>with å, ä and ö, that's what I think. I'll probably write to Jody
>implemented in the next version!

LOL! Actually, I have been trying to follow this thread, but my
time is limited. I have sent posts to me to file it as a bug. I'm
sure Eric will take it into consideration in the infamous
4.96/5.0/6.0 release. I'll push to get the extended characters
added along with giving "e" preference Don, but only after "E". :)

>Lotta - who is joking (better add that! ;-o))

Happy Topics,
Jody

The NoteTab Off-Topic List
mailto:ntb-OffTopic-Subscribe@yahoogroups.com
mailto:ntb-OffTopic-UnSubscribe@yahoogroups.com

All Fookes Software mailing lists and more...
http://www.fookes.us/maillist.htm
http://www.fookes.us/redir http://www.clean-funnies.com/
http://www.notetab.net/ http://www.sojourner.us/software
• Hi Don: ... Not quite correct Don as not all of your Calc statements are valid. Try the following to see what I mean. ^!Info [C]abcdetxy --
Message 9 of 22 , Mar 9, 2006
• 0 Attachment
Hi Don:

On Thu, 09 Mar 2006 08:46:18 -0500, Don - htmlfixit.com wrote:
> But when we use calc, we are all over the place ...
> ^!Info [C]abcdetxy -- ^\$IsNumber("^\$Calc(abcdetxy)\$")\$
> ^!Info [C]a -- ^\$IsNumber("^\$Calc(a)\$")\$
> ^!Info [C]aa -- ^\$IsNumber("^\$Calc(aa)\$")\$
> ^!Info [C]a*a -- ^\$IsNumber("^\$Calc(a*a)\$")\$
> ^!Info [C]e -- ^\$IsNumber("^\$Calc(e)\$")\$

Not quite correct Don as not all of your Calc statements are valid. Try the

following to see what I mean.

^!Info [C]abcdetxy -- ^\$IsNumber("^\$Calc(abcdetxy+0)\$")\$ --
^\$Calc(abcdetxy+0)\$
^!Info [C]a -- ^\$IsNumber("^\$Calc(a+0)\$")\$ -- ^\$Calc(a+0)\$
^!Info [C]aa -- ^\$IsNumber("^\$Calc(a+a)\$")\$ -- ^\$Calc(a+a)\$
^!Info [C]a*a -- ^\$IsNumber("^\$Calc(a*a)\$")\$ -- ^\$Calc(a*a)\$
^!Info [C]e -- ^\$IsNumber("^\$Calc(e+0)\$")\$ -- ^\$Calc(e+0)\$

Charlie
Charles M. Raine,
Winnipeg. MB R3P 0W3
Your message has been successfully submitted and would be delivered to recipients shortly.