I have found a simple floating point error and I was wondering if there is a way around it. I'm compiling in Haiku OS.  I'm in Haiku r1 Alpha 4  #include &lt;iostream&gt; #include &lt;cmath&gt;  float P(float PV, float r, int t){   return(r * PV/1-pow((1+r),-t)); }  int main(void){   float PV = 100000;   float r = .005;   int t = 350;    std::cout &lt;&lt; "A loan valued at $" &lt;&lt; PV &lt;&lt; " at a rate of %" &lt;&lt; r &lt;&lt; " with a payment period of " &lt;&lt; t &lt;&lt; "months would be $" &lt;&lt; P(PV,r,t) &lt;&lt; ", per-payment.\n";    return 0; }   When I run it P(PV,r,t) comes out as 499.834 it should be 500. Though if I set r = 0.06 P is correct and comes out as P = 6000.  Maybe it's a compiler error. I'm using gcc version 2.95.3-haiku-121101.
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
35km commute possible? Currently, on every other day I commute to work which is a distance of 18km each way. I enjoy this ride but next year I may be moving to a place which will be about 35km from work. Questions:  1) Would it still be reasonable to commute this kind of distance each way once I have moved?  2) Google maps estimates that this distance would take 2 hours to complete. Would it be possible (depending on the bike and fitness) to do this distance in about an hour? How do I install and manage RPMs? My current understanding:  $\vdash$ is "syntactic consequence", e.g. if we have $a \vdash b$ it means if we've written down $a$ as something we know, we can immediately write down $b$ as something we know. This is saying nothing about whether any of these pieces are true, false, something else, etc, it's just saying that we can say something about $b$ by virtue of being able to say something about $a$.  $\vDash$ is "semantic consequence", e.g. if we have $a \vDash b$, then it (usually) means if $a$ is always true in every interpretation (i.e. no matter how we mess with any of the underlying variables driving $a$'s valuation), then $b$ is true as well. However I don't know if this is necessarily just a "true"-only thing. It seems conceivable that we could make one for falsehoods too, i.e. if $a \vDash b$ might mean if $a$ is always false then $b$ is always false, of if $a$ is always "dog" then $b$ is always "dog", etc. But I am unsure of this one.  $\to$ is material implication, which exists solely within the logic system (as opposed to the previous two metalogical relations) and has a specific semantic meaning / definition in terms of a truth table in something like prepositional logic ($a \to b$ is always true unless $a$ is true and $b$ is false). It's defined this way simply because it is a helpful / useful model to describe things like "whenever $a$ is true, $b$ is true".  Do I have the right idea so far? How have Superman comics dealt with the Man of Steel, Woman of Kleenex problem? When I was a teen and Superman II came out, when Superman realized he and Lois were in love, he de-supered himself in the Fortress of Solitude so he could be with Lois.  Right after he emerged from the crystal cage that drained his powers, the first thing he does is take Lois' hand and escort her to a conveniently placed bed that we had never seen there before.  This implies it was necessary for him to lose his powers so he could have sex with Lois.  The problems involved in this situation are well covered in the wonderful essay by Larry Niven, .  But I also know that Superman has been in the comics for decades.  A friend of mine once said, "Oh, he tells her who he is a lot, but he always makes her forget it again later."  So how have the comic books (since this is Superman's primary medium) handled this?  Were there different ways it was handled, or was it always handled the same way?  Have they literally kept Superman and Lois from having sex for decades?  Or have there been times when they've ended up in bed together?  How do they deal with the issues of the Man of Steel having sex with, and not killing, a woman of Kleenex? I found some articles related to this, but they were not sufficient for me. I want to know how the localhost works and why is it the same on many different machines?   How does the localhost block the access to the website when we use it in the host file to block the website? How can I define a mathematical function as a LaTeX macro? What is the correct way to install proprietary ATI Catalyst Video Drivers (fglrx) directly from AMD? I consider the co-finite topology on $\mathbb{R}$ that is $$\{G\subset \mathbb{R}, card(\mathbb{R}\setminus G)&lt;+\infty\}\cup \{\emptyset\}$$  What are the convergent sequences in this space .  thank you Use of the comment package I was able to read and write NTFS filesystems normally in Mountain Lion, but after the upgrade this stopped to work.  I installed ntfs-3g and fuse4x using homebrew in Mountain Lion and followed the instructions displayed by homebrew to finish the installation of fuse4x kernel extension.  To try to solve this problem I removed ntfs-3g, fuse4x and fuse4x-kext and reinstalled them. But this didn't solve my problem.  Does anyone know how to solve this? Thanks. As we know, any proposition can translate to Godel numbers, such as  $$( \exists x)\space (x=sy)$$Its Godel numbers is $2^8 × 3 ^4 × 5^ {13} × 7^ 9 × 11^8 × 13^{13} × 17^ 5 × 19^ 7 × 23^ {17} × 29^ 9=a \space big \space number $  We also could get the character sequence "$( \exists x)\space (x=sy)$" through prime factorization of this big number.  Such as$$243,000,000=2^6×3^5×5^6 $$ $$6\space\space\space\space\space 5\space\space\space\space\space 6 $$ $$\downarrow\space\space\downarrow\space\space\downarrow$$ $$0\space\space\space=\space\space\space 0 $$ So $243000000$ is the Godel numbers of "$0=0$"   There are four axioms in Godel's PM system, here are two of them: $$(p\lor p)\subset p$$ $$p\subset (p\lor q)$$ through these two axioms, we can prove "$(p\lor p)\subset(p\lor q)$" is a true theorem.   And these two axioms and a theorem all have a corresponding Godel numbers, can we prove this theorem is true through Godel numbers? If it works, how? Compute $\int_0^\infty\frac{\cos(xt)}{1+t^2}dt$ Let $x \in \mathbb R$  Find a closed form of $\int_0^\infty\dfrac{\cos(xt)}{1+t^2}dt$ .   Let me give some context: this is an exercise from an improper integrals course for undergraduates. My teacher was not able to give a valid solution without  resorting to Fourier series.   He actually wanted to prove first that the function is a solution of the ODE $$ y-y'' =0$$ without succeeding in proving it.   Anyway the result sould be $\dfrac{\pi}{2}e^{-x}$  Thanks for any help on this subject. Novel about a dragon lord who has to wear gloves at all times Can generated OpenVPN keys be used on multiple clients? We are experimenting with running an OpenVPN server for our business. One question I can't seem to find the answer to is this:  When we generate keys for one of our users for them to use at home, can their use the same keys on their home laptop as well as their home desktop? Or do we need to generate separate keys for each user's client machine? Extracting text from HTML file using Python I'd like to extract the text from an HTML file using Python.  I want essentially the same output I would get if I copied the text from a browser and pasted it into notepad.    I'd like something more robust than using regular expressions that may fail on poorly formed HTML.  I've seen many people recommend Beautiful Soup, but I've had a few problems using it.  For one, it picked up unwanted text, such as JavaScript source.  Also, it did not interpret HTML entities.  For example, I would expect &amp;#39; in HTML source to be converted to an apostrophe in text, just as if I'd pasted the browser content into notepad.  Update html2text looks promising. It handles HTML entities correctly and ignores JavaScript.  However, it does not exactly produce plain text; it produces markdown that would then have to be turned into plain text. It comes with no examples or documentation, but the code looks clean.    Related questions: Provided we have this truth table where "$p\implies q$" means "if $p$ then $q$":  $$\begin{array}{|c|c|c|} \hline p&amp;q&amp;p\implies q\\ \hline T&amp;T&amp;T\\ T&amp;F&amp;F\\ F&amp;T&amp;T\\ F&amp;F&amp;T\\\hline \end{array}$$  My understanding is that "$p\implies q$" means "when there is $p$, there is q". The second row in the truth table where $p$ is true and $q$ is false would then contradict "$p\implies q$" because there is no $q$ when $p$ is present.  Why then, does the third row of the truth table not contradict "$p\implies q$"? If $q$ is true when $p$ is false, then $p$ is not a condition of $q$.  I have not taken any logic class so please explain it in layman's terms.       Administrative note. You may experience being directed here even though your question was actually about line 4 of the truth table instead. In that case, see the companion question  And even if your original worry was about line 3, it might be useful to skim the other question anyway; many of the answers to either question attempt to explain both lines. The statement is:     In a commutative ring with 1, every proper ideal is contained in a maximal ideal.   and we prove it using Zorn's lemma, that is, $I$ is an ideal, $P=\{I\subset  A\mid A\text{ is an ideal}\} $, then by set inclusion, every totally ordered subset has a bound, then $P$ has a maximal element $M$.  My question is why $M$ must contain $I$? How can I have a "Dear %firstname%" template in my Gmail? It seems to be a very easy thing but I am struggling to see how. I need a "Dear %firstname%,  [cursor here] Kind Regards etc" template in my Gmail account, so every time I click reply, it is already there. How can I do that? Image upload from photo gallery So this is pretty obvious. Image upload?    How about allowing to attach images in questions from the photo gallery, by perhaps sending the image for off-site storage like done from the full-web version? Is spacetime discrete or continuous? Is the spacetime continuous or discrete? Or better, is the 4-dimensional spacetime of general-relativity discrete or continuous? What if we consider additional dimensions like string theory hypothesizes? Are those compact additional dimensions discrete or continuous?   Are there experimental evidences of continuity/discreteness?  When particles move inside space do they occupy spacetime by little chunks? What would imply if spacetime is discrete on continuous theories?  I've found little information on the web and books.  Probably my question is ill-posed and I apologize for this.