I have a QVariant that stores a double value. One place the value is coming from is a QDoubleSpinBox (but not only!), which has a min (0.3) and max (1.0) as limits.  I've noticed that I get an exception (the code is written like this) when I set the value below the minimum. What's surprising is that I'm actually setting the value to 0.3.  Through debugging I found out that the following code is the reason why this is happening:  // value is QVariant auto valueDouble = value.toDouble(); // use valueDouble   What happens is that when I set the value to 0.3 internally   value = 0.3 valueDouble = 2.9999999999999999   And 2.9999... is definitely below 0.3 hence the reason why I get the exception. Of course the 0.3 is probably a display "error" by the debugger inside Qt Creator. Nevertheless I'm more concerned about the internal error.  I also tried using QVariant::toFloat() and I got 0.300000012.  Needless to say this not only creates poor user experience but internally also leads to all sorts of issues.  I can make it so that the QDoubleSpinBox doesn't allow such behaviour however as I've mentioned such values comes from different locations in the applications so this issue needs to be handled on a deeper level.
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
How much should a "button of Cure Light Wounds" cost (should it be available at all?) I accidentally moved all folders from root to a subfolder. (/bin, /etc, /home, /lib, /usr... all moved) The only ones that were not moved, since they were in use, are  /bak, /boot, /dev, /proc, /sys.  Now, any command that I try to execute will simply not happen. I constantly get "No such file or directory".  I am connected through ssh and through ftp, but I cannot move files through ftp, as direct SU login is disabled. I also have access to the actual server if I need to do something directly from there.  I'm assuming I would need to edit a configuration file in order to tell it where to find the /bin folder and that would help me get access again, but I don't know which file that would be or how to do it (since I can't even run chmod to change permissions).  Is there any way out of this other than re-installing?  I am working on an old version of CentOS.  I'm extremely new to the world of Linux, hence this action and the question... uniq command not working properly? So I'm checking the md5 hash of my files with this as my output:  657cf4512a77bf47c39a0482be8e41e0  ./dupes2.txt 657cf4512a77bf47c39a0482be8e41e0  ./dupes.txt 8d60a927ce0f411ec94ac26a4785f749  ./derpina.txt 15f63928b8a1d5337137c38b5d66eed3  ./foo.txt 8d60a927ce0f411ec94ac26a4785f749  ./derp.txt   However, after running find . -type f -exec md5sum '{}' ';' | uniq -w 33 to find the unique hashes I get this:  657cf4512a77bf47c39a0482be8e41e0  ./dupes2.txt 8d60a927ce0f411ec94ac26a4785f749  ./derpina.txt 15f63928b8a1d5337137c38b5d66eed3  ./foo.txt 8d60a927ce0f411ec94ac26a4785f749  ./derp.txt   From my understanding, only one of either derpina.txt or derp.txt should be showing up since their hashes are the same. Am I missing something? Can anyone enlighten me as to why it outputs like this? Run cmd.exe in Administrator mode without explorer.exe I've recently had trouble with explorer.exe not working.  I found a possible solution , using .  The problem is that I cannot "right-click Command Prompt, and then click Run as administrator", since explorer.exe does not work for even a second without crashing.  I tried to use the  to open cmd as administrator, but I get an error 1327 because I have a blank password.    My question is, is there any other way to run cmd.exe with admin privileges?  If not, is there any way to run sfc.exe without admin privileges?  If not, does anyone have solution to my original problem of explorer.exe stopping and restarting ad nauseam? Maximum length of tags Possible Duplicate:        Is there a maximum limit on the length of tags? I noticed that the tag for SQL Server Management Studio is truncated to sql-server-management-stu.  It seems like this should be an easy thing to correct, if not to allow the creation of new longer tags, but to correct existing tags that have been truncated. Cannot Select Linked When Sync Selection Is Enabled When using find, how do I return the file name and the line number when searching for a string? I manage to return the file name in one command and the line numbers with another one, but I can't seem to combine them.  File names: find . -type f -exec grep -l 'string to search' {} \;  Line numbers: find . -type f -exec grep -n 'string to search' {} \; How to import a module given its name as string? Can I travel to Australia in less than 2 weeks if I transfer my visa to my new passport? I transferred my visa to my new passport and it’s saying it takes 2 weeks to come, my flight is Sunday I arrive in Sydney Monday at night, I still have my old passport! If I bring that will they let me go into the country because my new one literally arrived two days ago! And the visa will be transferred in 2 weeks! Will I have to push my flight or will I be left? What is meant by "obfuscate by pretending"? I came accross the following sentence:  "Politicians obfuscate by pretending that the world would be the same if it weren't for the Cold War."  What is the meaning of obfuscate by pretending and how does it relate to the rest of the sentence?  The way I understood it: politicans are aware that the world would not be the same if it weren't for the Cold War, but are (due to unknown or suspected reasons) not willing to admit this and therefore pretend otherwise. Is there a case insensitive version of the  jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string? How to reconnect a logically disconnected USB device? It is possible for a USB storage device to become logically disconnected: the device is still plugged in, but is invisible from the operating system (e.g. it's not listed under /proc/bus/usb). Maybe this can happen to other kinds of USB or other removable devices as well. This can happen for example:   ; after VirtualBox has claimed a USB storage device (the device disappears from the Linux host when it is attached in the guest, and does not automatically reappear if it is detached from the guest).   What is going on in the driver or in the hardware, and most importantly, (how) can the device be logically reconnected (without physically plugging it out and back in)?  Note that this question is not about mounting. In the “logically disconnected” state, the kernel believes there is nothing on the USB bus (and so of course there is no entry under /dev). Adding console.log to every function automatically Wires do not connect in Circuitikz I've been trying to use relative coordinates to make my drawings more precise but it seems I don't know how the command \node works since I've been having this problem while connecting a circuit element to another:    I'm trying to eliminate the blank between the two wires.  This is the minimal code:  \documentclass{book} \usepackage[siunitx,RPvoltages]{circuitikz} %Circuit Schematics/Diagram \usetikzlibrary{arrows,shapes,calc,positioning} \begin{document}     \begin{circuitikz}             \path (0,0) coordinate (C);             % Comparatore             \path (C) + (0,-1) + (1,0) coordinate (com) node[above]{};             \path (com) + (1.5,-1) node[op amp] (comp) {};             % Collegamenti Comparatore             \node (G1) at ([shift=({-1.3cm,0cm})]comp.-) {};             \draw (G1) -- (comp.-);             \node (G2) at ([shift=({-1.3cm,0cm})]comp.+) {};             \draw (G2) -- (comp.+);             \draw (C) -- (G1); % Collegamento Rettificatore - Comparatore         \end{circuitikz} \end{document}   Thanks for any help! Quick question to anyone who has used this LaTeX template:    Any ideas on how to change the left margin to get more words onto one page? I need a CD or USB stick, that will install Ubuntu on a completely headless machine. Stick CD in and restart, no keyboard or screen should be involved.  There are a few obstacles:   The language selection menu when you first boot the CD. The fact that the CD menu waits. The installer's asking questions during installation. How do I extend a List in Dart? Egyptian fractions with prime power denominators summing to 1? Inspired by        Can we solve the equation $$1=\frac{1}{a_1}+\frac{1}{a_2}+\frac{1}{a_3}+\cdots +\frac{1}{a_n}$$ where $a_1,a_2,a_3,\cdots ,a_n$ are distinct prime powers (primes are allowed) ?   I tried a modified greedy-algorithm with different starting vectors and brute force with $6$ entris with limit $200$, but did not find a representation. Why don't Muggle-born wizards use Muggle technology to fight Death Eaters? We know that wizards in the Harry Potter universe are subject to regular physical harm (e.g. witness injuries from being hit by Bludgers or just colliding with things when playing Quidditch).  Therefore, it's almost a certainty that an average wizard would be vulnerable to, say, a bunch of bullets.   There may likely be spell(s) to protect from projectiles - witness Dumbledore's  deployed when Voldemort sent a bunch of glass at him during the  at the end of Harry Potter and the Order of the Phoenix (according to , possibly an unusually powerful Protego or the Silver shield).   But:   those spells obviously take effort/energy/time to cast (not everyone's Dumbledore) AND more likely than not most Death Eaters wouldn't recognize a Muggle gun for a threat (or realize what kind of threat) till too late.   So, the guns should at best allow an over-matched OotP member (e.g. Harry or Hermione) to greatly equalize the power between any regular Death Eaters and themselves, and even perhaps help against Voldemort (who can't be killed with a bullet, but, at best, would need to expend magical energy and time into conjuring a shield, and, at worst, be stopped/interrupted/driven off).  So I'm looking for an explanation - ideally in-universe, but possibly just some statement by JKR - of why the Muggle-born OotP - who are likely very much at ease AND familiar with Muggle technology and live in the late 20th century - do not use guns. Or, for that matter, ANY Muggle technology of the late 20th century? Cue Arthur C. Clarke's "indistinguishable from magic" meme.  Even if they are on some kind of idiotic moral crusade to never kill their opponents (even the Jedi aren't this dumb), given the time-frame, non-lethal weapons would have already existed, such as rubber bullets and tasers.  NOTE: Please don't offer the "if they do it, Death Eaters would start using guns as well" theory. First, Death Eaters would have used the guns if they knew how to, anyway. Second, the guns, like any "secret weapon", could be reserved for strategic battles, say the defense of Hogwarts in Deathly Hallows.    The origin of the question stems from two things.  First, Harry's fascination with all things that are different in the magical world (e.g. moving photographs), based on his knowledge of the Muggle material world, as well as the somewhat amusing cluelessness of the "Muggle artifacts" expert, Mr. Weasley, regarding Muggle items and how they work.   Basically, from the books, it's clear that the Wizarding world wouldn't know details about guns or what they are for or how they work.  The second thing is it's clear, at least initially, that wizards are afraid of Muggles finding out about them. Hence all the efforts to cloak their society (basically, do you REALLY want every Muggle gunning for you, even with Magic)? The idea of how control over the Muggle world seems to be more indirect, by Death Eaters asserting mind-control over the government. This means there's an implicit understanding by Death Eaters that they don't stand a chance against armed Muggles even given the magical disparity.  Considering Harry and Hermione's overall adaptability and inventiveness (and brains in the latter case), it's mind-boggling that the idea of fighting Death Eaters with modern technology completely slipped their mind. I mean, it's a basic part of human myth (see Steel vs. Magic themes in Conan books, or Beowulf, or heck, A Yankee in King Arthur's Court). So it's not like the idea of using technology against magic would be impossible to come up with. The question begs itself - why not? Considering the fact that Rowling generally tried to be logical and consistent in building the HP universe, I feel like there must be some in-universe explanation for this that I just didn't notice.   (in-universe answers only unless there are some authoritative out-of-universe statements that are part of canon). Good-morning Math Exchange (and good evening to some!)  I have a very basic question that is confusing me.   At school I was told that $\sqrt {a^2} = \pm a$  However, does this mean that $\sqrt {a^2} = +2$ *and*$-2$ or does it mean: $\sqrt {a^2} = +2$ *OR*$-2$  Is it wrong to say 'and'? What are the implications of choosing 'and'/'or'  Any help would be greatly appreciated. Thanks in advance and enjoy the rest of your day :)