Not getting exact value from float calculations in a java code Basically I am changing layout ratios. I have to change current layout ratio to another ratio. There is a code snippet I am using in my application. import java.util.*; public class Big{   public static void main(String args[]){ float b=(new Scanner(System.in)).nextFloat(); float a=(b*((float)225/440));  //Another layout ratio height System.out.println(a);  //Back to previous layout height float c=(a*((float)440/225)); System.out.println(c);    }  }  Below are some input and their respected outputs: On input value- 50,60.0,65 and 69.9999, Code is returning same outputs-50,60.0,65 and 69.9999 respectively. But when I am trying to put 70 and 80, Code is returning approximate values as 69.99999 and 79.99999 respectively. The question is- Why am I getting these approximate value not exact values in case of 70 and 80. There can be some other cases. I am trying to get exact values in all the cases.
Is floating point math broken? Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
Table of Contents with Chapter I'm attempting to modify the Table of Contents in my document. Currently, chapter one in my document is listed as   1   Introduction   What I would like to see is  Chapter 1   Introduction   Seems like an easy enough thing to ask for, but can't seem to find a good way to do this. Any feedback would be most appreciative. The FAQ says that Community Wiki works:     by transferring ownership of the post   from the original author to the   community. They make the post easier   to edit and maintain by a wider group   of users, but they do not contribute   to any user's reputation.   But using the new edit suggestion system, everyone can edit. It's no longer true that community wiki makes a post easier to edit.  Does community wiki still serve a function?    What are good examples of community wiki mode doing what it's supposed to do? I'm looking for an ASCII art generator (text is preferred, but images will do too) in the  style, but with text instead of trains. Any suggestion? Subscribing to questions and comments that don't belong to you B2B application: users has its own users B2B Scenario I am trying is that:  The following Roles exists in the system:  Super Admin Super Admin Staff Owner (client) Admin (owner i.e. client and creates admin to define sales counters) Sales Counters  That means there are users who'll create their own sub users e.g.  [FLAG-A] ROLE &quot;SUPER ADMIN&quot; creates a ROLE &quot;Owner&quot; and &quot;OWNER&quot; creates its own sub users ROLES i.e. &quot;ADMN&quot; &amp; &quot;SALES COUNTER&quot;. Each role obviously has its info to login to the system I tried to design database as following:  In this diagram I am assuming that main user creates sub user that in my view many to many relationship so I have to add table between them as &quot;USER_PERSON&quot;. Problem is to set &quot;WHO CREATED USER&quot; in the system. I mean which user has created sub user as described in [FLAG-A]  Please check this diagram I want to know if I can pass an argument with an alias command.  for example:  alias d="dmesg|grep -iw usb|tail -5"    Now d will print the last 5 lines. If I want to use d to print a different number of lines, I have to make change in the alias command declaration of d again.  Is there any way I can modify the declaration of an alias so that I don't have to retype the declaration to change the number of lines. Like incorporating passing the number of lines as an argument while declaring alias for d? Or is there some other method to solve this? Probability of asymmetric random walk returning to the origin Consider the random walk $S_n$ given by $ S_{n+1} =  \left\{   \begin{array}{l}     S_n+2 &amp; \text{with probability $p$}\\     S_n - 1 &amp; \text{with probability $1-p$}   \end{array} \right. \ $  Assume that $S_0 = n &gt;0 $. What is the probability of eventually reaching the the point $0$?  Seems that the probability for this must be less than one; since it is not symmetric, it is not guaranteed to reach the origin if $p&gt;0.5$. It also seems like the positive starting value not being at the origin matters too, but I'm not sure how to compute the probability of eventually reaching the origin. I want to monitor the output of a command and whenever it contains a certain string I want to run another command.  Example: when command1 outputs 1234 I want to run command2 How many "super imaginary" numbers are there? How many "super imaginary" numbers are there? Numbers like $i$? I always wanted to come up with a number like $i$ but it seemed like it was impossible, until I thought about the relation of $i$ and rotation, but what about hyperbolic rotation? Like we have a complex number $$ z = a + bi $$ can describe a matrix $$ \begin{bmatrix} a &amp; -b \\ b &amp; a\end{bmatrix} $$ You can "discover" $i$ by doing (which is used for another discovery) $$ \begin{pmatrix} a \\ b \end{pmatrix} \cdot \begin{bmatrix} c &amp; -d \\ d &amp; c\end{bmatrix} = \begin{pmatrix} ac - bd \\ ad + bc \end{pmatrix} $$ $$ (a + bi) \cdot (c + di) = ac + adi + bci + bdi^2 $$ From here on you can infer that $ i^2 = -1 $.  So what if we do the same thing, but a different matrix? $$ z = a + bh$$ can describe a matrix $$ \begin{bmatrix} a &amp; b \\ b &amp; a\end{bmatrix} $$ and we can discover it the same way $$ \begin{pmatrix} a \\ b \end{pmatrix} \cdot \begin{bmatrix} c &amp; d \\ d &amp; c\end{bmatrix} = \begin{pmatrix} ac + bd \\ ad + bc \end{pmatrix} $$ $$ (a + bh) \cdot (c + dh) = ac + adh + bch + bdh^2 $$ From here we infer that $ h^2 = 1 $.  Also $$ e^x = 1 + \frac{x}{1!} + \frac{x^2}{2!} + \frac{x^3}{3!} + \frac{x^4}{4!} + \frac{x^5}{5!} + \cdots  $$ $$ \begin{align} e^{xh} &amp; = 1 + \frac{xh}{1!} + \frac{(xh)^2}{2!} + \frac{(xh)^3}{3!} + \frac{(xh)^4}{4!} + \frac{(xh)^5}{5!} + \cdots \\ &amp; = 1 + \frac{xh}{1!} + \frac{x^2}{2!} + \frac{x^3h}{3!} + \frac{x^4}{4!} + \frac{x^5h}{5!} + \cdots \\ &amp; = \cosh{x} + h \cdot \sinh{x} \end{align} $$  How many more numbers like this are there? And does that mean that for each set of trigonometric functions there exists a number which can turn multiplication into a rotation using those trigonometric functions?  (Sorry if I got some things wrong) Batch fit images into ratio with blurred background I need to resize a lot of images into a 4:3 ratio with the desired effect.  Is there a way to do this using photoshop actions? (the background can be scaled or two copies moved to the sides, either way works)     image credits: In ZFC set theory, every element object is a set. We know or feel that if $X$ and $Y$ are sets, their cartesian product $X\times Y$ is a set.  My question is: Why if $X$ and $Y$ are sets, their cartesian product $X\times Y$ is a set? text-overflow: ellipsis in table-cell without width Cardinality of set of real continuous functions Can I use apt-get or aptitude to install software to non standard location? Windows Starter Edition, Home and Home Premium do not include gpedit, how do I install it? I want to make some changes to Windows that require using the Group Policy Editor (gpedit.msc).  Unfortunately the Group Policy Editor is not included with the Starter Edition, Home and Home Premium editions of Windows.  How can I install it? More than one time dimension We know that space-time dimensions are 3+1 macroscopically, but what if 2+2?  Obviously it is tough to imagine two time dimensions, but mathematically we can always imagine as either having two parameters $t_1$ and $t_2$ or else in Lorentz matrix $$\eta_{00} = \eta_{11} = -1$$ and, $$\eta_{22} = \eta_{33} = 1.$$  Is there any physical reason for not taking this, like the norms become negative or something else? I am currently using 19.04 and I got "No new release found for 19.10" I’m not sure What it is? I’m trying to get a glossy shade to building in my scene as soon as I put roughness to zero I see these trees in glass. I have no trees in my scene anywhere, background is black. Even when I render I see these trees. How can I get rid of them and still keep my glossy building material. What is a word/phrase for using a term for a popular special case instead of a generic term? Geometric interpretation of the multiplication of complex numbers? I've always been taught that one way to look at complex numbers is as a Cartesian space, where the real part is the $x$ component and the imaginary part is the $y$ component.  In this sense, these complex numbers are like vectors, and they can be added geometrically like normal vectors can.  However, is there a geometric interpretation for the multiplication of two complex numbers?  I tried out two test ones, $3+i$ and $-2+3i$, which multiply to $-9+7i$.  But no geometrical significance seems to be found.  Is there a geometric significance for the multiplication of complex numbers?