No announcement yet.


  • Filter
  • Time
  • Show
Clear All
new posts

  • #21
    In the Users Guide, check out chapter 10, "Floating Point".

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


    • #22
      .. seems to be an area that suffers from a serious lack of understanding, even by experienced [emphasis mine] programmers
      Frankly,I would be reluctant to use the adjective "experienced" to describe a programmer who does notunderstand both the capabilities and the limitations of various datatypes.

      But, if there is such a lack of knowledge among programmers who might otherwise be labelled, "experienced," I will place the blame on the development language publishers who offer "typeless" variables (e.g., "the variant") to the programmer.


      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]


      • #23
        This Thread has lost it's purpose some while back

        The original question was why 5 figures, the result of some prior calculation,
        did not add up correctly !

        Whether or not the programmer understands the lower level of coding is beside
        the point if he only has to deal with the used programming language's variables,
        relying on them to provide accurate results. There is a lot of undocumented
        stuff about, the Manuals do not tell you !

        As Lance confirmed, there is an inaccuracy with ROUNDING in all languages, which
        have been reported in the Media frequently.

        It puzzled me years ago why a variable being tested for ZERO and confirmed as
        such by the program's code, was in fact 0.0000095 or similar. ZERO values
        in VAL(String), PRINT USING, to mention but two. My QUATTRO and EXCEL
        Spreadsheets sometimes display this inaccuracy unless I do complicated rounding
        formulae to compensate for it.

        Not important enough in most cases, but when plotting a course to distant planets,
        accuracy to the infinitive part of a calculation is necessary if you do not want
        to find yourself in a Galaxy you did now want to be in

        I have a small program called "TEST" I use to put troublesome code parts
        through their paces before committing them to the real thing. Trying it with various
        options and combinations and if you are as stubborn as me, you will eventually find
        the answer


        [This message has been edited by OTTO WIPFEL (edited April 06, 2002).]


        • #24
          Well, it would be more accurate to say that the effects of rounding can produce results are different than may be expected.

          Seriously, an understanding of floating-point operation and how overall precision is affected by the choice of variable class is paramount to writing technically accurate as well as numercially accurate applications.

          For example, (and this is not directed to anyone in particular) ask yourself if you understand the limits of precision as applied to a set of "simple" calculations, such as:
          x% = 1%
          y! = x% / 10
          z& = y! * 10e8
          print x%, y!, str$(y!,18), z&
          If you do not know what the likely results of these four lines of code will be, try it, then start reading the Floating Point chapter in the documentation. You'll thank yourself later!

          BTW, the results are 100% accurate within level of precision that the lowest precision data type offers... but if you do not expect to see these effects in such "simple" calculations, you just might be surprised.

          PowerBASIC Support
          mailto:[email protected][email protected]</A>
          mailto:[email protected]


          • #25
            You are really a Treasure, Lance

            God only knows what all these youngsters (and old-timers) would do without your
            advice !

            Had a look at the chapter you referred to. Mind you, it is the PB-DOS 3.0
            Manual I was looking at. The 3.5 Manual was printed so badly, I had to bin it.

            I am mostly dealing with monetary values in my Accounting Software. Since
            the introduction of the "@" variable, all my problems disappeared

            Dates ? I store them as Strings "YYYYMMDD". That way they can be easily checked
            for which is the most recent and all sorts of calculations can be performed
            using Alan Earnshaw's tools. Number of Days between Dates, number of Days added
            to or taken away from Dates, and so on.

            Important when you are dealing with Loan Periods and Interest thereon !

            [This message has been edited by OTTO WIPFEL (edited April 07, 2002).]


            • #26
              I prefer to store dates in Julian format, using a Long-integer -- 4 bytes only.

              BTW, my printed copy of the 3.5 book set is printed 100% perfectly, and I've heard of no other complaints about the print quality of the many thousands of books sold.

              Therefore, if you were unhappy with the print quality inthe copy your received, you could have taken it up with PowerBASIC Sales... I'm sure they would have been happy to exchange it for you. Naturally, if you purchased from a dealer/reseller (for example, Gray Matter UK), you'd really have had to talk to them in the first instance. But since you threw your copy away (!), I guess this discussion is moot.

              JFYI, Sales tell me there are still some copies of the 3.5 books available.

              In case you are not aware, the two documentation books are available in PDF/electronic format now... to get your own copy, simply email a request for them to mailto:[email protected][email protected]</A> and include your PB/DOS serial number, name and address, etc.

              I hope this helps!

              PowerBASIC Support
              mailto:[email protected][email protected]</A>
              mailto:[email protected]


              • #27

                Sorry, I was not specific enough.

                It was the PB-DOS 3.5 Reference Guide which had double print on many pages, making
                them virtually unreadable.

                Must have been from the first batch "Rushed" from the printers. I was one of first
                to buy 3.5 when it was released way back.

                I mentioned it at the time but was not bothered then nor now to get a replacement.
                Learned more from you guys in the meantime and still am, PB Gazette #28

                Thanks, Lance.


                [This message has been edited by OTTO WIPFEL (edited April 09, 2002).]