Shop OBEX P1 Docs P2 Docs Learn Events
numbers greater than FFFF — Parallax Forums

numbers greater than FFFF

ArchiverArchiver Posts: 46,084
edited 2003-02-11 19:21 in General Discussion
How do you guys count numbers greater than 65535? I would like a
decimal output . . . thanks!

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-02-11 16:40
    Well, you cannot stick a number greater than 65535 into a variable
    but it you are just talking counting then you could do something like
    this:

    X VAR WORD
    Y VAR WORD

    For X = 0 to 65535
    For Y = 0 to 65535
    Next
    Next

    This would make your STAMP count to 4294967296.

    --- In basicstamps@yahoogroups.com, "jrem123 <jrem123@y...>"
    <jrem123@y...> wrote:
    >
    > How do you guys count numbers greater than 65535? I would like a
    > decimal output . . . thanks!
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-11 16:47
    right, got that, but how do I output a decimal number?
    Do I need some routine to turn $x and $y into z$ and
    output my decimal as a string?


    --- "dirt939 <stamp@d...>"
    <stamp@d...> wrote:
    > Well, you cannot stick a number greater than 65535
    > into a variable
    > but it you are just talking counting then you could
    > do something like
    > this:
    >
    > X VAR WORD
    > Y VAR WORD
    >
    > For X = 0 to 65535
    > For Y = 0 to 65535
    > Next
    > Next
    >
    > This would make your STAMP count to 4294967296.
    >
    > --- In basicstamps@yahoogroups.com, "jrem123
    > <jrem123@y...>"
    > <jrem123@y...> wrote:
    > >
    > > How do you guys count numbers greater than 65535?
    > I would like a
    > > decimal output . . . thanks!
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >


    __________________________________________________
    Do you Yahoo!?
    Yahoo! Shopping - Send Flowers for Valentine's Day
    http://shopping.yahoo.com
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-11 17:57
    I have got this method before from Tracy Allen:

    'count up to 99999999
    xlow var word
    xhigh var word
    xlow=9990 'demo starting value
    incrementcount
    xlow=xlow+1 //10000 'roll over at 9999
    xhigh=xhigh + 1-(xlow max 1)
    debug dec4 xhigh,dec4 xlow,cr
    goto icrementcount

    regards






    >From: "jrem123 <jrem123@y...>" <jrem123@y...>
    >Reply-To: basicstamps@yahoogroups.com
    >To: basicstamps@yahoogroups.com
    >Subject: [noparse][[/noparse]basicstamps] numbers greater than FFFF
    >Date: Tue, 11 Feb 2003 14:00:21 -0000
    >
    >
    >How do you guys count numbers greater than 65535? I would like a
    >decimal output . . . thanks!
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    >Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


    _________________________________________________________________
    Tired of spam? Get advanced junk mail protection with MSN 8.
    http://join.msn.com/?page=features/junkmail
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-11 18:01
    >How do you guys count numbers greater than 65535? I would like a
    >decimal output . . . thanks!

    Hi John,

    One way to do this is to count modulo 10000, so that the maximum
    count is then 100,000,000 in two words, displayed using the normal
    DEC operator:

    '{$PBASIC 2.5}
    x0 var word ' low word of the count 0 to 9999
    x1 var word ' high word
    x0=9990 ' arbitrary starting value
    do
    x0=x0+1//10000 ' up to 9999
    x1=x1 + 1-(x0 max 1) ' ten-thousands -- carry
    ' note the term in () equals zero only when x0=0
    ' so x1 is incremented only when x0 rolls over from 9999 to 0000
    debug dec x1,dec4 x0,cr ' display double precision
    loop

    I have lots of double precision routines posted at this URL:

    http://www.emesystems.com/BS2math6.htm

    including one that converts double precision in the form $hhhh:$llll
    into decimal (using double precision divide by 10 in a loop).

    -- Tracy
  • ArchiverArchiver Posts: 46,084
    edited 2003-02-11 19:21
    perfect, thanks Tracy and refky, and thanks for the
    link.


    --- Tracy Allen <tracy@e...> wrote:
    > >How do you guys count numbers greater than 65535?
    > I would like a
    > >decimal output . . . thanks!
    >
    > Hi John,
    >
    > One way to do this is to count modulo 10000, so that
    > the maximum
    > count is then 100,000,000 in two words, displayed
    > using the normal
    > DEC operator:
    >
    > '{$PBASIC 2.5}
    > x0 var word ' low word of the count 0 to 9999
    > x1 var word ' high word
    > x0=9990 ' arbitrary starting value
    > do
    > x0=x0+1//10000 ' up to 9999
    > x1=x1 + 1-(x0 max 1) ' ten-thousands -- carry
    > ' note the term in () equals zero only when
    > x0=0
    > ' so x1 is incremented only when x0 rolls
    > over from 9999 to 0000
    > debug dec x1,dec4 x0,cr ' display double
    > precision
    > loop
    >
    > I have lots of double precision routines posted at
    > this URL:
    >
    > http://www.emesystems.com/BS2math6.htm
    >
    > including one that converts double precision in the
    > form $hhhh:$llll
    > into decimal (using double precision divide by 10 in
    > a loop).
    >
    > -- Tracy
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to
    > http://docs.yahoo.com/info/terms/
    >
    >


    __________________________________________________
    Do you Yahoo!?
    Yahoo! Shopping - Send Flowers for Valentine's Day
    http://shopping.yahoo.com
Sign In or Register to comment.