When I run this code:    Double test = (23.1d + 0.1d);   Log.i(Constants.TAG, "Test: " + test);   I get:   Test: 23.200000000000003   I need to add values that will at most have two decimals. For example 19.99 + 0.1 =20.09, how can I do it so that precision is not lost?
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
I installed Ubuntu 14.04.1 on one of my laptops and now I want distribute that exact installation to a few of my friends. I tried making an iso with Gparted on a live session but it makes a 500 GB file (I've only used around 8 GB) .   Thanks in Advance ! I'm describing a situation that happened in the past. To explain it, I want to use a description that is both true now and true when the situation happened.  Specifically, I want something like:     She touched me where my neck met my collarbone.   Since my neck is still attached to my collarbone (thankfully), I'm wondering if I shouldn't use the present tense here instead:     She touched me where my neck meets my collarbone.   Which is preferable, and why? Should you choose the MONEY or DECIMAL(x,y) datatypes in SQL Server? I'm curious as to whether or not there is a real difference between the money datatype and something like decimal(19,4) (which is what money uses internally, I believe).  I'm aware that money is specific to SQL Server. I want to know if there is a compelling reason to choose one over the other; most SQL Server samples (e.g. the AdventureWorks database) use money and not decimal for things like price information.    Should I just continue to use the money datatype, or is there a benefit to using decimal instead? Money is fewer characters to type, but that's not a valid reason :) Changed response to Recommendation questions now that there's a site for them? Are features that allow −5 to attack to get +10 to damage mathematically sound? Some class features, monster traits, and feats allow you to take a −5 to your attack roll in order to gain a +10 to your damage roll. At first glance this looks really good, but when will it deal more damage than not using it on average?  For instance if you have a total attack bonus of +8 and you deal 1d12 damage. You have to roll a 7 to hit an AC of 15. If you take the −5 that makes it where you have to roll a 12. That's going to reduce your average damage by a lot. Compare nullable types in Linq to Sql I have a Category entity which has a Nullable ParentId field. When the method below is executing and the categoryId is null, the result seems null however there are categories which has null ParentId value.  What is the problem in here, what am I missing?  public IEnumerable&lt;ICategory&gt; GetSubCategories(long? categoryId) {     var subCategories = this.Repository.Categories.Where(c =&gt; c.ParentId == categoryId)         .ToList().Cast&lt;ICategory&gt;();      return subCategories; }   By the way, when I change the condition to (c.ParentId == null),  result seems normal. How do I split a string, breaking at a particular character? How do I invoke a Java method when given the method name as a string? On every loading of a lib, I get the error:     no version information available   This lib has been compiled on another PC (ubuntu 10.04) than the one running it (mandriva 2010.2).  $ ldd /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so: /lib/libz.so.1: no version information available (required by /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so)  linux-gate.so.1 =&gt;  (0xffffe000)  libz.so.1 =&gt; /lib/libz.so.1 (0xb77a7000)  libc.so.6 =&gt; /lib/i686/libc.so.6 (0xb7655000)  /lib/ld-linux.so.2 (0xb787a000)   Edit: the workaround didn't work. Question is :  Suppose $Y\subset X$ and $X,Y$ are connected and $A,B$ form separation for $X-Y$ then, Prove that  $Y\cup A$ and $Y\cup B$ are connected.  What i have tried is :   Suppose $Y\cup A$ has  separation say $C\cup D$ then all i could see is that   Either $Y\subset C$ or $Y\subset D$ as $Y$ is connected and $ C\cup D$ is separation for a subset that contains $Y$.  Without loss of generality we could assume $Y\subset C$  As $Y\cup A=C\cup D$ and $Y\subset C$  i can say $D\subset A$ (I do not know how does this help)  I have $X-Y=A\cup B$ with $A\cap B=\emptyset$  I have not used connectedness of $X$ till now, So i thought of using that and end up with following :   $X-Y=A\cup B\Rightarrow X=Y\cup A\cup B=(Y\cup A)\cup (Y\cup B)$  I do not know what to conclude from this...   I would be thankful if some one can help me by giving some "hints"  Thank you I’m looking for a word I’m struggling to remember that refers to a job or role which is inconsequential and usually created in order to install someone in a company, not based on their merit.  An example would be creating a vague new role for a friend’s son. The word I’m looking for refers to the actual job itself - it’s a noun that would replace the ‘job’ (e.g “they put so and so’s cousin in a ____”).   I believe the word may not be a strictly formal or technical word but I don’t think it was slang. Please provide a mobile-optimized captcha page Is there a name for "the string of characters typed randomly on a keyboard home row"? How do I force a column-break in a two-column document? How do I use the Chinese remainder theorem to find all the square roots of 11 in $\mathbb Z_{35}$? Remove Reviewer and Steward badges Badges should encourage good behaviour. But what when a badge encourages more bad behaviour than good?  We hear it all the time - robo reviewers, badge-hunters. The review system fights with that users that only want badges and not want to help.  There are many suggestions how to find such robo-reviewers or how to make it difficult to robo-review. But why not cut them off at the source? Don't make them want to review for badges at all.  Remove the Reviewer and Steward badges! The Custodian Bronze badge should suffice to bring a user to the review system. And we really only want users doing reviews who want to help and not doing it for the badges. JSF 2.0 File upload bash is not terminating I'm trying some things with my shell. This includes the following command:  kill $$  My expectation was that the shell would log me out and terminate itself. But instead the bash persists without change.   Any idea why?  I ran this command on different environments (archlinux, debian). The behavior was always the same. Remove extra header lines from file, except for the first line I have a file that looks like this toy example.  My actual file has 4 million lines, about 10 of which I need to delete.  ID  Data1  Data2 1    100    100 2    100    200 3    200    100 ID  Data1  Data2 4    100    100 ID  Data1  Data2 5    200    200   I want to delete the lines that look like the header, except for the first line.  Final file:  ID  Data1  Data2 1    100    100 2    100    200 3    200    100 4    100    100 5    200    200   How can I do this? How do you debug through a compressed JavaScript file?