Python: weird rounding behavior of math.sqrt() Using Python 2.7.10, I have found quite by accident that 5*math.sqrt(3) and math.sqrt(5**2*3) are not the same float:  import math import decimal  print decimal.Decimal(5*math.sqrt(3)) print decimal.Decimal(math.sqrt(5**2*3)) print 5*math.sqrt(3) == math.sqrt(5**2*3)   returns   8.660254037844385521793810767121613025665283203125 8.6602540378443872981506501673720777034759521484375 False   which shows that they differ on the 15th decimal place. Intriguingly, this does not happen for numbers neighboring 5 and 3. The following code show a few pairs of numbers for which the equality fails:  for j in range(1,10+1):     for i in range(1,10+1):         a = i*math.sqrt(j)         b = math.sqrt(i**2*j)         if not(a == b):             print [i,j],   The list of problematic [i,j] pairs include: [3, 2] , [6, 2] , [9, 2] , [5, 3] , [9, 3] , [10, 3] , [3, 6] , [6, 6] , [7, 6] , [3, 8] , [6, 8] , [9, 8] , [5, 10] , [7, 10] , [10, 10]... Any ideas on why the rounding breaks, and why precisely for these pairs, and not others?
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?
Blank white desktop icons on new Windows 7 install Suppose there are several journals with the same impact factor. Is it better to submit my papers to one of them or each time I finished a manuscript it is better to submit to an equally good journal that I have not published in yet.  I am early in my career and I already published two papers in the same journal and I am going to finish my third paper, which potentially can be published in the same journal as my previous two papers. How to sanity check a date in Java external variable in awk Can anyone enter as a student at the Citadel ? Or must one be recommended by Lords or a powerful institution?   Aemon Targaryen was a son of a King, so the Citadel would let him access without questioning. Samwell Tarly was sent by Lord Commander Jon Snow, from the Night's Watch. , a novice of the Citadel. A common born but it is not known how he entered the Citadel. We can notice that he is not a good student, but has not been fired.    I don't remember how the other Maesters were recruited, if they are always relatives of Lords, Kings... Can any lowborn commoner just "knock the door", and enter the Citadel? $C^1[a,b]$ is closed in $C[a,b]$ Is it necessary to use commas in lists before the conjunction? I have seen many sentences like this:     "Capitalism, Socialism, and Anarchism"   and this:     "She was happy, and cheerful"   Do we have to use a comma before "and", or is it incorrect?  If it is not, then why? Who is the Community user? Linux Equivalent of Windows Ctrl to show Mouse Pointer In Windows, it is possible to set pressing Ctrl to display the current location of the mouse pointer, as per .  Is there a way of setting a key or key combination to perform the same action in Ubuntu? Note, this is the opposite of turning this function off, as detailed at . UK visit visa: What documents prove genuine relationship with the visitor? In the UK immigration rules for visitor visa  it states if;      Funds, maintenance and accommodation provided by a third party      V 4.3 A visitor’s travel, maintenance and accommodation may be   provided by a third party where the decision maker is satisfied that   they:      (a) have a genuine professional or personal relationship with the   visitor;and      (b) are not, or will not be, in breach of UK immigration laws at the   time of decision or the visitor’s entry to the UK; and      (c) can and will provide support to the visitor for the intended   duration of their stay.   I'm a UK  citizen. I'm planning to invite my brother-in-law and another close friend to the UK. In my invitation letter, I have clearly mentioned that I'm going to provide them accommodation only. They have prove sufficient funds to support themselves. I have sent them an invitation letter along with a copy of my passport and tenant agreement.   What other documents do I need to provide to indicate that it is a genuine professional or personal relationship with the visitor? What is LookDev/Material Preview mode for in 2.8? Why is FIFA against adding instant replay to the game? Is there any evidence or reason why FIFA is so against adding instant replay to soccer? I find myself seeing many unlucky or just plain wrong decisions made by refs that could be corrected with instant replay. How can I stop applications and services from running? When my phone starts up there are several application/services running in the background that I would rather not.  And when I press the Home button while using an app, that app usually goes into the background without exiting.  How can I stop these apps from running? Force figure placement in text I have a problem when a lot of figures are in question. Some figures tend to "fly around", that is, be a paragraph below, although I placed them before that paragraph. I use code:  \begin{figure}[ht] \begin{center} \advance\leftskip-3cm \advance\rightskip-3cm \includegraphics[keepaspectratio=true,scale=0.6]{slike/visina8} \caption{} \label{visina8} \end{center}\end{figure}   to place my figures. How can I tell latex I REALLY want the figure in that specific place, no matter how much whitespace will be left? Most efficient method to break Ubuntu Why can't Transporter technology be used as a weapon? Seems like this is the most powerful weapon of all: transport your enemy into a bulkhead, planet, etc. Transport your enemy's ship inside a planet, etc.  Is there some technical reason that it can not be used this way? Is there a single word for a "friend of a friend"? I am looking for a word that I could use instead of "friend of a friend". On certain occasions, it happens that you may want to talk about a friend of a friend with someone else.   In such cases how would you refer to this friend? Command-line mv exclusion list I'd like to declare some new operators using \DeclareMathOperator and some of the names are already taken by other commands (that I do not want to use). Is there an equivalent to the \renewcommand command for \DeclareMathOperator or a different way to overwrite the commands using \DeclareMathOperator? Understanding central limit theorem What is wrong with the following sentence:      The Central Limit Theorem  implies that, as the sample size grows, the error distribution approaches normality.   Am I correct by saying that it should in stead state the MEAN of the sample error approaches zero as sample size grows?