You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
.. 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.
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).]
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:
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.
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).]
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.
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).]
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment