Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] isnumber function

Expand Messages
  • Larry Hamilton
    ... 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 1 of 22 , Mar 8 8:34 PM
    • 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
    • Bill Newman
      ... 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 2 of 22 , Mar 8 10:08 PM
      • 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
      • Don - htmlfixit.com
        ... 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 3 of 22 , Mar 9 5:46 AM
        • 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 ;-)
        • Hugo Paulissen
          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 4 of 22 , Mar 9 6:44 AM
          • 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
          • Jody
            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 5 of 22 , Mar 9 1:31 PM
            • 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
              >about this. I demand that åäö calculation will be properly
              >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
            • Charles M. Raine
              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 6 of 22 , Mar 9 7:45 PM
              • 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.