Announcement

Collapse
No announcement yet.

PB DOD "PRINT" Oddity!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Arthur Gomide
    replied
    Originally posted by James Horner:
    You didn't read my post!
    I apologize!
    PB32 has this problem - to be safe you must use the trick of Mr. Bishop says above.
    PB35 runs your code fine!

    Best Regards,

    Arthur.




    ------------------

    Leave a comment:


  • James Horner
    replied
    You didn't read my post!
    N is double word
    N = 98765432
    PRINT N gives 8.876543E7

    BUT, PRINT (N - 10000000 + 10000000)
    gives the 8 digit integer 98765432

    Nothing is different about the number in question
    but PRINT renders then differently.

    ------------------

    Leave a comment:


  • James Horner
    replied
    As I said in the riginal post, N was declared as
    a double word variable!

    ------------------

    Leave a comment:


  • Michael Mattias
    replied
    Help file under PRINT tells you why..
    PRINT displays single-precision quantities with up to 6 significant
    digits, and other quantities with up to 16 digits. Extended-precision,
    binary coded decimal, and quad integer values with 17 or 18 digits must
    be printed via the STR$ function if all digits are to be displayed.
    .. which is, "because that's the way it works."

    Leave a comment:


  • Arthur Gomide
    replied
    Originally posted by James Horner:

    Any guesses why??
    The type of N means to be single-precision (default for variables without type declaration in PB32) in your example, and single-precision has a precision of 6 to 7 decimal digits.
    Try defining N as a double word with:

    DEFDWD N

    'and then

    N = 23456789
    PRINT N ' now gives 23456789
    PRINT (N - 10000000 + 10000000) ' now gives 23456789

    Best Regards,

    Arthur.

    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    I can't answer your question but when dealing with numbers like
    that, I usually use something like:
    Code:
    fmt$ = "##,###,###.##"   ' or use whatever format style that
    print;using$(fmt$,n)     ' floats your boat.
    This gives proper display 99 times out of a hundred.


    ------------------

    Leave a comment:


  • James Horner
    started a topic PB DOD "PRINT" Oddity!

    PB DOD "PRINT" Oddity!


    I stubled onto this oddity with PBDOS 3.2
    using "PRINT" command.
    I'm working with very large positive integers --in
    declared as DOUBLWRD
    With numbers N > 10,000,000 , PRINT N
    showa on screen the a.bcd...E7 format
    'and I lose the final digit.
    However for such numbere, if I program it as
    PRINT (N - 10000000 + 10000000) I get the full
    eight digit numer on screen!
    e.g.
    N = 23456789
    PRINT N gives 2.345678E7, But
    PRINT (N - 10000000 + 10000000) gives 2345678 !
    Any guesses why??

    ------------------
Working...
X