Shop OBEX P1 Docs P2 Docs Learn Events
PUB decn...do you have it PhiPi? — Parallax Forums

PUB decn...do you have it PhiPi?

HarleyHarley Posts: 997
edited 2010-08-02 02:57 in Propeller 1
Sorry to bother you Phil, but I can't locate your 13 Jul 2010 posting of this.

The cat walked across the keyboard while I was modifying some Spin located just below that PUB. Well her foot steps selected the latter half of the PUB and keyed in lots of jibberish. So I manually corrected, I thought, what got clobbered. Later I realized that 'decn' is clobbered and prints 4 or 5 digits even though say 3 are desired.

Is it possible you recall the forum thread on 13 Jul.? I can't locate it. Just a reference to the thread title will be sufficient. The cats sure can crreate problems with one's source; or chew cables, or my original PropPlug cable. yeah.gif Thanking you in advance

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Harley Shanko

Post Edited (Harley) : 8/1/2010 3:49:17 AM GMT

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-01 05:29
    Even better...

    www.bitboost.com/pawsense/

    -Phil
  • HarleyHarley Posts: 997
    edited 2010-08-01 05:47
    Yep, that's it Phil. Many thanks. I had one line missing somehow.

    PawSense! How cute. Will look into it later.

    ElectricAye, why don't you like cats?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-08-01 05:59
    Harley said...
    ...
    ElectricAye, why don't you like cats?

    I love cats. They make excellent pencil sharpeners!

    357749.jpg
  • BrowserBrowser Posts: 84
    edited 2010-08-01 08:17
    Mee-ouch! Not again! ElectricAye has made his feelings towards my species known before:

    ····http://forums.parallax.com/showthread.php?p=861174

    The man is obviously beyond redemption!

    (BTW, Phil thinks that that stupid pawsense program can keep me from using his computer! Ha!)

    -Browser
  • BradCBradC Posts: 2,601
    edited 2010-08-01 12:36
    I love cats, I just can't eat a whole one [noparse];)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "I mean, if I went around sayin' I was an emperor just because some moistened bint had lobbed a scimitar at me they'd put me away!"
  • HarleyHarley Posts: 997
    edited 2010-08-01 17:47
    @PhiPi,

    Your 'decn' has two lines with "digits < 0" in it. Why would it not be "digits > 0"? As in why display anything if it isn't 1 or more digits?

    I'm getting strange results and haven't been able to figure out where the problem is. I get 4 digits displayed (and entirely wrong values) when 3 are specified!!!

    Since decn had no comments I tried to add some, but didn't understand some of what was going on; sure, I could guess, but I've been wrong at least 'once' before. (The "ADD COMMENTS HERE" was a note to myself to try to understand and describe what's happening.)
    PUB decn(value, digits) | mindigits, val               ' from PhiPi 13 Jul.2010 on forum
    '' Print a decimal number, right-justified in a field width given by digits.
      mindigits := ((value < 0) & 1) + 1                            ' ADD COMMENTS HERE
      if (value <> $8000_0000)
        val := || value
        repeat while (val /= 10)                            ' determine # digits
          mindigits++
      if (value < 0 and digits < 0)
        printStr(string("-"))                               ' if negatkve, print '-'
        value := ||value                                    ' make absolute value '||'
      repeat (||digits - mindigits) #> 0
        if (digits < 0) 
          printStr(string("0"))
        else
          printStr(string(" "))
      dec(value)                                              ' print the value in decimal format
    
    


    A few more moments of your time would be appreciated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-08-01 18:21
    You can specify padding with leading 0's instead of blanks by setting digits less than 0. The absolute value of digits is used to determine the field width. If the field required to hold the number (mindigits) is greater than the field width specified, the larger value will be used instead. If value is negative, a minus sign will be inserted just to the left of the leftmost printed digit.

    -Phil
  • HarleyHarley Posts: 997
    edited 2010-08-01 18:26
    Ah, leading zeros. That I didn't expect. Guess if I'd entered some -n value for digits it would have shown itself.

    Thank you so much for the clarification.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Harley Shanko
  • Cluso99Cluso99 Posts: 18,069
    edited 2010-08-02 02:29
    Just think of how many cats were used for their wiskers for making crystal sets LOL

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
    · Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-08-02 02:57
    Cluso99 said...
    Just think of how many cats were used for their wiskers for making crystal sets LOL

    And many more whiskers were used for micro-manipulating cells on microscope slides, he laughs with an evil echo, curling his mustache.
Sign In or Register to comment.