No announcement yet.

Bug in putnum() format codes

  • Filter
  • Time
  • Show
Clear All
new posts

  • Bug in putnum() format codes

    There appears to be a bug in the format codes for the putnum (and print) function. If I use the [HEX4Z] format code, the number is printed without the leading zeros. If I use the numeric format code [0x1410], the number is printed as expected.

    I think there is a mismatch in the PICASOFUNCTIONS.FNC file:

    // hex, with leading zero's
    HEX 0x1410 // hex, 4 digits, leading zeroes
    HEX1 0x1110 // hex, 1 digit, leading zeroes
    HEX2 0x1210 // hex, 2 digits, leading zeroes
    HEX3 0x1310 // hex, 3 digits, leading zeroes
    HEX4 0x1410 // hex, 4 digits, leading zeroes

    // hex, no leading zero's
    HEXZ 0x0410 // hex, 4 digits, no leading zeroes
    HEX1Z 0x0110 // hex, 1 digit, no leading zeroes
    HEX2Z 0x0210 // hex, 2 digits, no leading zeroes
    HEX3Z 0x0310 // hex, 3 digits, no leading zeroes
    HEX4Z 0x0410 // hex, 4 digits, no leading zeroes


  • #2

    As odd as it may seem, it is working as designed.

    HEX is normally written with leading zeros, hence [HEX] has them and [HEXZ] doesn't

    DEC is the other way around.

    Hence HEX and DEC are the 'normal' representations and HEXZ and DECZ are the opposite, perhaps reverZe normal.


    • #3

      If you look in this way, then it is fine. Nevertheless, I would suggest that you put a description of each format in the Internal functions manual, otherwise you have to guess what the format means. I was guessing and my guess was wrong...



      • #4
        And what about BIN numbers? They are normally without leading zeros like DEC? I don't think so ...

        Please at least write samples below corresponding constant names to Internal Function Manuals !

        And I vote to make a new self descriptive constants like DEC2, DEC02, DEC_2, HEX2, HEX02, HEX_2, BIN8, BIN08, BIN_8 etc.
        But the problem is with todays HEX2 which should be without leading zeros ...
        If you don't like to make a compatibility switch, the new constants should be in a form Dec2, Hex2, etc.