When given the input 150, I expect the output to be the mathematically correct answer 70685.7750, but I am getting the wrong output 70685.7812.  #include&lt;stdio.h&gt;  int main() {   float A,n,R;    n=3.14159;    scanf("%f",&amp;R);   A=n*(R*R);    printf("A=%.4f\n",A); }
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
Question:  Is exception handling in Java actually slow?  Conventional wisdom, as well as a lot of Google results, says that exceptional logic shouldn't be used for normal program flow in Java.  Two reasons are usually given,   it is really slow - even an order of magnitude slower than regular code (the reasons given vary),     and    it is messy because people expect only errors to be handled in exceptional code.     This question is about #1.  As an example,  describes Java exception handling as "very slow" and relates the slowness to the creation of the exception message string - "this string is then used in creating the exception object that is thrown. This is not fast."  The article  says that "the reason for this is due to the object creation aspect of exception handling, which thereby makes throwing exceptions inherently slow".  Another reason out there is that the stack trace generation is what slows it down.  My testing (using Java 1.6.0_07, Java HotSpot 10.0, on 32 bit Linux), indicates that exception handling is no slower than regular code.  I tried running a method in a loop that executes some code.  At the end of the method, I use a boolean to indicate whether to return or throw.  This way the actual processing is the same. I tried running the methods in different orders and averaging my test times, thinking it may have been the JVM warming up.  In all my tests, the throw was at least as fast as the return, if not faster (up to 3.1% faster).  I am completely open to the possibility that my tests were wrong, but I haven't seen anything out there in the way of the code sample, test comparisons, or results in the last year or two that show exception handling in Java to actually be slow.  What leads me down this path was an API I needed to use that threw exceptions as part of normal control logic.  I wanted to correct them in their usage, but now I may not be able to.  Will I instead have to praise them on their forward thinking?  In the paper , the authors suggest that the presence of exception handlers alone, even if no exceptions are thrown, is enough to prevent the JIT compiler from optimizing the code properly, thus slowing it down.  I haven't tested this theory yet. How do I debug Node.js applications? Completing a 3x3 correlation matrix: two coefficients of the three given I was asked this question in an interview.  Lets say we have a correlation matrix of the form \begin{bmatrix}1&amp;0.6&amp;0.8\\0.6&amp;1&amp;\gamma\\0.8&amp;\gamma&amp;1\end{bmatrix}  I was asked to find the value of gamma, given this correlation matrix. I thought I could do something with the eigenvalues, since they should be all greater than or equal to 0.(Matrix should be positive semidefinite) - but I don't think this approach will yield the answer. I am missing a trick.  Could you please provide a hint to solve for the same? Is there a way to separate variables between multiple notebooks? I have looked everywhere for lava or obsidian in 0.7.1. I've looked all the way from top to bottom and all around, in about a 100 block diameter, but I can't find any. Where can I get some? Why isn't the 'len' function inherited by dictionaries and lists in Python example:  a_list = [1, 2, 3] a_list.len() # doesn't work len(a_list) # works   Python being (very) object oriented, I don't understand why the 'len' function isn't inherited by the object.  Plus I keep trying the wrong solution since it appears as the logical one to me Which is correct? - "Guess, what it is?" or "Guess, what is it?" I want to know which sentence is correct. If i say     Guess, what it is?   or     Guess, what is it?   which one is correct? I'm just starting to learn LaTeX. I tried typing \begin{equation*}  (math goes here)  \end{equation*}  and I got a whole bunch of errors. It seems LaTeX interpreted the empty line as the equation: when it saw nothing there, I guess it just ended math mode? It then said my other commands needed $'s so I assume that's what happened. When I typed \begin{equation*} (math goes here) \end{equation*}  everything was fine. So I'm confused. If LaTeX sees an empty line in an environment, does it just interpret this as me changing my mind, and deciding not to use the declared environment? How to get city name from latitude and longitude coordinates in Google Maps? In linear regression, when is it appropriate to use the log of an independent variable instead of the actual values? How to stop Katoolin from crashing Ubuntu? How can I make sure that only low and medium security inmates are in a specific area? Is it possible to reverse the overlay you can set? It seems like you are only able to clear areas for low OR medium security prisoners, but sharing is not possible. The thing I want here is to make sure that max security prisoners are not in certain areas. Cursor is set to move by increments. how to reset to normal? Nested Radical of Ramanujan I think I have sort of a proof of the following nested radical expression due to Ramanujan for $x\ge 0$.     $$\large x+1=\sqrt{1+x\sqrt{1+(x+1)\sqrt{1+(x+2)\sqrt{1+\cdots}}}}$$ for $ x\ge -1$   I just want to know if my proof is okay or there is a flaw, and if there is one I request to give some suggestions to eliminate them. Thank you. The proof is the following:  Proof: Let us define $$ a_n(x)=\underbrace{\sqrt{1+x\sqrt{1+(x+1)\sqrt{1+(x+2)\sqrt{1+\cdots}}}}}_{n \ \mbox{terms}}$$ for $x\ge 0$ so that $$ a_1(x)=\sqrt{1+x},\ a_2(x)=\sqrt{1+x\sqrt{1+(x+1)}},\ a_3(x)=\cdots$$    and so on. Since $x\ge 0$ each one of the $a_n$ is defined (I am taking only the positive square root). Also, we note that $$a_{n+1}^2(x)=1+xa_{n}(x+1)$$  Now, we note that $\{a_n(x)\}$ is an increasing sequence and that $$a_n(x)&lt;x+1$$ $\forall n\ge 1$, this is easy to prove by induction as below:  For $n=1$, $a_1(x)=\sqrt{1+x}&lt;1+x$ since $x\ge 0\Rightarrow 1+x\ge 1$. SO it is true for $n=1$. Similarly, the truth can be proved for $n&gt;1$.  Then $a_n(x)$ converges to $$l(x)=\sup_{n}a_n(x)\le x+1$$ Now I make the following claim:  Claim: $l(x)=x+1\quad \forall i\ge 0$  Proof: Fix $x$. Let $l(x)&lt;x+1$. Then, $l(x)=x+1-\epsilon$ for some $\epsilon&gt;0$. Now, I claim that there must be a $n$ such that $$x+1-a_n(x)&lt;\epsilon$$, and if that is true then $$a_n(x)&gt;x+1-\epsilon=l(x)$$ which is a contradiction since $$l(x)=\sup_{n}a_n(x)$$ and then it implies that $$l(x)=x+1$$ To prove my claim it requires $$x+1-a_n(x) &lt;  \epsilon$$ Now, \begin{align} x+1-a_n(x) = &amp; x+1-\sqrt{1+xa_{n-1}(x+1)} \\ \ =&amp; \frac{(x+1)^2-({1+xa_{n-1}(x+1)})}{x+1+\sqrt{1+xa_{n-1}(x+1)} } \\ \ =&amp; x\frac{(x+1)+1-a_{n-1}(x+1)}{x+1+\sqrt{1+xa_{n-1}(x+1)} } \\ \ &lt;&amp; \frac{x}{x+2}((x+1)+1-a_{n-1}(x+1))\\ \ &lt;&amp; \frac{x}{x+2}\cdot\frac{x+1}{x+3}((x+2)+1-a_{n-2}(x+2))\\ \ &lt;&amp; \frac{x}{x+n-1}\cdot \frac{x+1}{x+n} ((x+n-1)+1-a_{1}(x+n-1))\\ \ &lt;&amp; \frac{x}{x+n-1}\cdot \frac{x+1}{x+n}(x+n-\sqrt{x+n})\\ \ &lt;&amp; \frac{x(x+1)}{x+n-1} \end{align}  Now, if one is able to find $n$ such that $$\frac{x(x+1)}{x+n-1}&lt;\epsilon \Rightarrow x&lt; \frac{-(1-\epsilon)+\sqrt{(1-\epsilon)^2+4\epsilon(n-1)}}{2}$$ then we're done.   Now from the upper bound it seems that there always exists some $n$ that satisfies this requirement. Hence the claim is proved. How to modify an invalid '/etc/sudoers' file? Why do we need virtual functions in C++? How can I force SQL Server Management Studio to update the IntelliSense cache? IntelliSense in SSMS isn't updating unless I shut it down and restart. I've tried disconnecting from the server and reconnecting while the SSMS session is active, but that isn't working.  Steps to recreate:    Create a table  Select something from that table SSMS displays squiggly red lines under it with the tip "invalid object name" Execute the query   How can I force IntelliSense to update without restarting SSMS? Java FileInputStream ObjectInputStream reaches end of file EOF Galois extension is (not) transitive Let $ K/ L /F $ be fields. If $K / L$ is Galois and $ L / F $ is Galois, then $ K / F$ is Galois. We mentioned this very quickly in today's class without justifying. But I have trouble seeing this. Any help is appreciated.  Our definition for $ K / F$ being Galois is the $F$-automorphism group $G = G( K / F) : = \{ \sigma \in aut (G) : \sigma_F = id_F \}$ fixes only $F$, i.e. $ \{ x \in K : \sigma (x) = x \text { for all } \sigma \in G  \} = F$.  But we also showed that $ K /F$ is Galois if and only if $ K/F$ is normal and separable. How do I control Macbook volume when a DP display is connected? When I plug my Mac  into a DisplayPort monitor that has loudspeakers, the Mac's volume controls become disabled.    Is Apple assuming that if I have external speakers I am so much better using their own volume control that I have to be forced to do it?   That is annoying because the monitor's volume controls are buried in terrible menus accessed by terrible buttons on the back of the monitor.  Also, if I am inside an app where I can select the audio device and I select the Mac's internal speakers, the volume controls are STILL disabled.  Is there no way to control the volume of an app when an external speaker is connected even if the app is not using the external speaker?????  Some additional info: It's a Macbook Pro 13" 2018 version.  Using a Thunderbolt to Displayport cable, plugging in to a Dell monitor with speakers.    In another location I use the same cable to plug in to Dell monitors with Displayport but without built in speakers in the monitors.   At that location the volume controls remain active and they control the internal speaker in the laptop as they should.