The floor method of  returns the next integer for large float values of only 9.  Why is that?  irb(main):041:0&gt; (100.67893).floor =&gt; 100 irb(main):042:0&gt; (100.99999999999999999).floor =&gt; 101 irb(main):043:0&gt; (99.9999999).floor =&gt; 99 irb(main):044:0&gt; (99.9999999999999999999).floor =&gt; 100
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
Make mouse left-handed and touchpad right-handed I see that I can configure mouse and touchpad all in one panel (Ubuntu 13.10, defaults, Gnome). Which is to some extend. Namely, I want to have the touchpad differently configured then the mouse and ...  When I have an (USB) mouse attached I use it normally left-handed. Therefore I switch the buttons to left-handed. But when I use the touchpad I feel little bit lost with that kind of configuration. Therefore I wanna have it right-handed.  Is there a way to achieve the following: when I plugin a mouse (respectively when it is detected) automatically switch to left-handed and when I unplug it, switch automatically to right-handed? Python Implementation of Track-to/aim constraint Given: $a = qb + r$. Then it holds that $\gcd(a,b)=\gcd(b,r)$. That doesn't sound logical to me. Why is this so?    Addendum by LePressentiment on 11/29/2013: (in the interest of  and averting a duplicate)  What's the intuition behind this result? I only recognise the proof and examples solely due to algebraic properties and formal definitions; I'd like to apprehend the result naturally. Javascript multiple replace Inductive proof that ${2n\choose n}=\sum{n\choose i}^2.$ I would like to prove inductively that $${2n\choose n}=\sum_{i=0}^n{n\choose i}^2.$$  I know a couple of non-inductive proofs, but I can't do it this way. The inductive step eludes me. I tried naively things like $${2n+2\choose n+1}={2n+2\over n+1}{2n+1\choose n}=2\cdot {2n+1\over n+1}{2n\choose n},$$  But I don't think it can lead me anywhere. I would like the proof to be as simple as possible. What is the difference between "till" and "until"? What is the difference between till and until?    When to use till or until? Please explain with examples. Is it possible to recover an email that has been clicked "delete forever" in the trash folder? If A and B play a game with a fair coin such that A wins by getting consecutive TT for the first time, while B wins by getting a consecutive TH.  Who has higher probability of winning the game?   I tried the following method but not sure:  For A to win,     TT, HTT, HHTT ... that is, 2-k for each game length k   For B to win,     TH, HTH, HHTH ... that is, 2-k for each game length k   So ultimately I am getting same probability of each to win. Printing out Stack Overflow/Exchange Q&As including comments? Sort a Map by values Installing Ubuntu from a partition on internal drive I am about to install Ubuntu on my new laptop, but I don't have access to a USB drive of any sort and it doesn't have an optical drive. Would it be possible to boot into the Ubuntu installer if I save it to a new partition on my hard drive and boot from there via the BIOS?  In case you need it, , which lists my system specifications.  Thanks in advance for any assistance you may be able to provide. :) Determining application path in a Python EXE generated by pyInstaller I have an application that resides in a single .py file.  I've been able to get pyInstaller to bundle it successfully into an EXE for Windows.  The problem is, the application requires a .cfg file that always sits directly beside the application in the same directory.  Normally, I build the path using the following code:  import os config_name = 'myapp.cfg' config_path = os.path.join(sys.path[0], config_name)   However, it seems the sys.path is blank when its called from an EXE generated by pyInstaller.  This same behaviour occurs when you run the python interactive command line and try to fetch sys.path[0].  Is there a more concrete way of getting the path of the currently running application so that I can find files that are relative to it? Apache2 restart failed in Ubuntu 16.04 Too many blanks between summation symbol and its associated expression How to sort lines by float number I've such a file:  name: xxx --- time: 5.4 seconds name: yyy --- time: 3.2 seconds name: zzz --- time: 6.4 seconds ...   Now I want to sort this file by these float numbers to generate a new file as below:  name: yyy --- time: 3.2 seconds name: xxx --- time: 5.4 seconds name: zzz --- time: 6.4 seconds ...   I've tried the command awk '{print $5}' myfile | sort -g but this will show me ONLY the float numbers. What is the $n$ times iterate of $f(x)=\frac{x}{\sqrt{1+x^2}}$? I'm trying to compute this integral, $$\int_{0}^{\infty}\frac{\ln x}{x^{a}(x+1)}dx \hbox{ where } 0&lt;a&lt;1$$ I drew a typical Pacman contour with branch cut at positive real axis. Then, we have $$\int_{\Gamma}\frac{\ln z}{z^{a}(z+1)}dz=\left(\int_{L_{1}}+\int_{L_{2}}+\int_{C_{R}}+\int_{C_{\epsilon}}\right)\frac{\ln z}{z^{a}(z+1)}dz$$ The function has a pole at $z=-1$. Then, by residue theorem, the whole integral becomes  \begin{align*} \int_{\Gamma}\frac{\ln z}{z^{a}(z+1)}dz&amp;=2\pi i\text{res}(\frac{\ln z}{z^{a}(z+1)};-1)\\&amp;=2\pi i\lim_{z\rightarrow-1}(z+1)\frac{\ln z}{z^{a}(z+1)}\\&amp;=2\pi i\lim_{z\rightarrow-1}\frac{\ln z}{z^{a}}\\&amp;=2\pi i\frac{\ln e^{i\pi}}{e^{i\pi a}}\\&amp;=2\pi i\frac{\ln1+i\pi}{e^{i\pi a}}\\&amp;=-\frac{2\pi^{2}}{(e^{i\pi})^{a}} \end{align*} On $L_1$, $z=xe^{i\epsilon}$ where $\epsilon\leq x\leq R$  On $L_{2}$, $z=xe^{i(2\pi-\epsilon)}$ where $\epsilon\leq x\leq R$  On $C_{R}$, $z=Re^{i\theta}$ where $\epsilon\leq\theta\leq2\pi-\epsilon$  Lastly on On $C_{\epsilon}$, $z=\epsilon e^{i\theta}$ where $\epsilon\leq\theta\leq2\pi-\epsilon$  So I tried to compute them separately and I anticipate the curves will both go to $0$ by ML inequality, and two linear integrals will consist of the term $\int_{0}^{\infty}\frac{\ln x}{x^{a}(x+1)}dx$ and hence simply solve for it. But I'm having trouble physically solving it out. I think the log is throwing me off. Can anybody please help me? Programmatically get own phone number in iOS Is there any way to get own phone number by standard APIs from iPhone SDK? PHP replacing special characters like à->a, è->e Graphics horribly corrupted on Ubuntu 16.04 in VirtualBox, showing random strips of pixelated colors