Date published 


Why do developers need a guidebook for C++ and OO technology? 4. What kind of guidance is given in the answers to these FAQs?.. 5. What is the. Cline's C++ FAQ Lite document, You can also download an electronic copy via the web (it's a MB PDF file; cost . In part it's because this is a merger of two great FAQs: Marshall Cline's C++ online C++ FAQ Lite, Bjarne Stroustrup's online C++ and C++11 FAQs, and in the .

Language:English, Spanish, Portuguese
Genre:Fiction & Literature
Published (Last):16.01.2016
Distribution:Free* [*Registration needed]
Uploaded by: GRISEL

50065 downloads 128642 Views 28.39MB PDF Size Report

C++ Faq Lite Pdf

Thank you for reading this answer rather than just trying to set your own coding standards. But beware that some people on maroc-evasion.infoc++ are. What other C++ FAQs are available? .. FAQ Lite c ++-faq-lite/. Marshall Cline's excellent. FAQ. Comeau. Online C++ FAQ/Tutorial and Advanced Questions. Alexis Angelidis. January 11, 1 Quick notes to C programmers. • instead of macros use. – const or.

Why do I feel so confused, so stupid? Isn't that a contradiction in terms? Why doesn't this print 0. Or sine or tangent or log or just about any other floating point computation [ Is it of type int? What can you do with it? It's a randomly ordered collection containing a few questions newbies might ask.

NaN means "not a number," and is used for floating point operations.

There are lots of floating point operations that don't make sense, such as dividing by zero, taking the log of zero or a negative number, taking the square root of a negative number, etc. Depending on your compiler, some of these operations may produce special floating point values such as infinity with distinct values for positive vs. If your compiler produces a NaN, it has the unusual property that it is not equal to any value, including itself.

In fact, if a is NaN, then a will be neither less than, equal to, nor greater than any value including itself. Why doesn't this print 0. However, people keep asking about it on comp. Answer: Floating point is an approximation. The IEEE standard for 32 bit float supports 1 bit of sign, 8 bits of exponent, and 23 bits of mantissa.

Since a normalized binary-point mantissa always has the form 1. The number The fractional part is 0. With 24 bits of mantissa you only get about 1 part in 16M of precision for float.

The double type provides more precision 53 bits of mantissa. Because floating point arithmetic is different from real number arithmetic. So read this FAQ and you'll know what to do. The reason floating point will surprise you is that float and double values are normally represented using a finite precision binary format. In other words, floating point numbers are not real numbers. For example, in your machine's floating point format it might be impossible to exactly represent the number 0.

By way of analogy, it's impossible to exactly represent the number one third in decimal format unless you use an infinite number of digits. To dig a little deeper, let's examine what the decimal number 0. This number has a 6 in the "tenths" place, a 2 in the "hundreths" place, and a 5 in the "thousanths" place.

In other words, we have a digit for each power of But in binary, we might, depending on the details of your machine's floating point format, have a bit for each power of 2.

So the fractional part might have a "halves" place, a "quarters" place, an "eighths" place, "sixteenths" place, etc. Let's pretend your machine represents the fractional part of floating point numbers using the above scheme it's normally more complicated than that, but if you already know exactly how floating point numbers are stored, chances are you don't need this FAQ to begin with, so look at this as a good starting point.

On that pretend machine, the bits of the fractional part of 0. In other words, 0. But on this pretend machine, 0. You can get close but you can't represent it exactly. The message is that some floating point numbers cannot always be represented exactly, so comparisons don't always do what you'd like them to do.

In other words, if the computer actually multiplies That's the problem. Now here's the solution: be very careful when comparing floating point numbers for equality or when doing other things with floating point numbers; e. From a practical standpoint, does not usually occur when the magnitudes of x and y are significantly larger than epsilon, but your mileage may vary.


For other useful functions, check out the following listed alphabetically : Isaacson, E. Kahan, W. Knuth, Donald E. Although note some negative reviews, such as amath. Stoer, J. Double-check your assumptions, including "obvious" things like how to compute averages, how to solve quadratic equations, etc.

Do not assume the formulas you learned in High School will work with floating point numbers! You might also want to read this supplement by Doug Priest.

Super-FAQ : Standard C++

You might also want to go here for links to other floating-point topics. Or sine or tangent or log or just about any other floating point computation I know it's hard to accept, but floating point arithmetic simply does not work like most people expect.

You might not like that, but it's the way it is. The only way to "get it" is to set aside your assumptions about how things ought to behave and accept things as they actually do behave.

Let's work a simple example. Turns out that on some installations, cos x!

Полезные страницы

That's not a typo; read it again if you're not shocked: the cosine of something can be unequal to the cosine of the same thing. Or the sine, or the tangent, or the log, or just about any other floating point computation. If that doesn't shock you, you're asleep; read it again. If you want, try it on your particular computer.

You might also like: EBOOK A ELITE

Some of you will end up in the if block, some will not, and for some it will depend on the details of your particular compiler or options or hardware or the phase of the moon. Why, you ask, can that happen? Not only has it caused confusion for many, it has resulted in a plethora of worthless email in my inbox. I couldn't ever seem to get "over the hump": no matter how clear I made the current version, hundreds perhaps thousands of people were unaware that they were reading an outdated version.

That made it harder for both them and me. Something like, "Your copy of the FAQ is out of date; if you want to upgrade, click here". Note: I haven't built this feature yet; please be patient.

The goal is to help you keep up-to-date, so you won't end up reading outdated information. And also to keep my inbox from getting flooded with questions from confused readers who are reading a copy of the FAQ written before they discovered Fire.

So please please don't send me e-mail asking for an FTP address since there isn't one. Yes there is a big difference. Bottom line: the book and this Lite document are not the same. My sources are: The bookstores at the Technion and the University of Haifa, books that are sent to me by publishers, and books that are shown to me by students.

The bad ones - find their way here.

I do not really read them, because I have specific criteria that make a book bad to my view - usually, exemplifying that the author or whoever wrote a particular part of the book has a misunderstanding of the programming language at question, or a misconception of basic programming techniques in that language. Then, I exemplify my findings with quotes from the book. Let me emphasize that the only reason I put books here, is to warn my students from learning from them - I consider these books a "risk" to my students' grades, if they base their answers at the exam on these books.

By the way, even the list of bad books in Hebrew is not complete. All others, I just do not mention - they are not good enough to be recommended, and I have not found reasons which are good enough to justify public denunciation namely, they are not that big "risk" to my students. The opinions below are solely mine, and represent what I have learned about high quality programming from my own experience, and by learning from many others.

If you think I am mistaken in any of the items below, please inform me - and I will correct it if you are right. Notes: New books are added to the list whenever I have the time. I have a long list of comments on each book. I have given you only a few examples. The errors I have found were not found by reading the books, but by leafing through them - there must be many more that I have not found.

Some of the books may have updated editions. I hope they have corrected some of the errors. Nevertheless, it would not change my opinion about the books, since I do not comment on typos or overlooked errors. My comments refer to basic knowledge of the programming languages and to basic knowledge of programming techniques. If the authors want to write a good book, they should not rewrite the old one - they should start from scratch. But I care for the students in Israel, so I comment on books that are available in Israel - mainly in Hebrew and in English sorry, I do not know Russian, however, several books in Russian that I have seen are translations of books that appear on this list ;-.

On the contrary, they are bad enough to cause my students to loose valuable points in their exams - if they use these books to learn these languages.

Similar files:

Copyright © 2019
DMCA |Contact Us