Why does my Python script give incorrect moduli? I am right now playing with some code to try &amp; get more familiar with Python &amp; I made a change calculator in which you input a certain amount of money &amp; it gives you the change you have to return (In Euros). However, I saw it would sometimes give a faulty result for the €0.01 change.  After doing some research, I saw the results for (x mod 20) would give a very strange number. For example, 20.03 mod 20 gives 0.030000000000001137. This problem also occurs for modulo 0.02 (in which the result becomes 0.030000000000001136). My code is as follows:  money = 20.33   # Input here the amount of money you would like to change moneydivs = [500, 200, 100, 50, 20, 10,              5, 2, 1, 0.50, 0.20, 0.10, 0.05, 0.02, 0.01] list = [] i = 0 countpos = 0 moneyoriginal = money   def printlines(pos):     print(f'{list[pos]} pieces of €{str(moneydivs[pos])}')   print('-----------[Steps in between (For bug hunting)]-----------') for num in moneydivs:     if money == 0:         break     list.append(int(money // num))     print(f'num = {num} &amp; '           f'floor devision = {money // num} and modulus = {money % num}')     money = money % num     countpos += 1  print('-----------[Casual output itself]-----------') print(f'To change {moneyoriginal}, you have to give:') while i &lt; countpos:     if list[i] == 0:         i += 1         continue     if i &gt; 8 and i &lt; 12:         moneydivs[i] = str(moneydivs[i]) + "0"         # Adds a 0 behind the decimal cents     printlines(i)     i += 1   And the output is as following:  -----------[Steps in between (For bug hunting)]----------- num = 500 &amp; floor devision = 0.0 and modulus = 20.33 num = 200 &amp; floor devision = 0.0 and modulus = 20.33 num = 100 &amp; floor devision = 0.0 and modulus = 20.33 num = 50 &amp; floor devision = 0.0 and modulus = 20.33 num = 20 &amp; floor devision = 1.0 and modulus = 0.3299999999999983 num = 10 &amp; floor devision = 0.0 and modulus = 0.3299999999999983 num = 5 &amp; floor devision = 0.0 and modulus = 0.3299999999999983 num = 2 &amp; floor devision = 0.0 and modulus = 0.3299999999999983 num = 1 &amp; floor devision = 0.0 and modulus = 0.3299999999999983 num = 0.5 &amp; floor devision = 0.0 and modulus = 0.3299999999999983 num = 0.2 &amp; floor devision = 1.0 and modulus = 0.12999999999999828 num = 0.1 &amp; floor devision = 1.0 and modulus = 0.029999999999998278 num = 0.05 &amp; floor devision = 0.0 and modulus = 0.029999999999998278 num = 0.02 &amp; floor devision = 1.0 and modulus = 0.009999999999998278 num = 0.01 &amp; floor devision = 0.0 and modulus = 0.009999999999998278 -----------[Casual output itself]----------- To change 20.33, you have to give: 1 pieces of €20 1 pieces of €0.20 1 pieces of €0.10 1 pieces of €0.02   I don't understand where this offset comes from, or in case of my current code: Why 20.33 mod 20 = 0.33 - 1.7E-15. Where does the -1.7E-15 come from?  I should add that I'm using the Hydrogen package (in Atom) to give this output. Is there a possibility the issue may lay here?  Sorry if the question is a little bit messy. I get that I should not add my complete code, but I believe in the current case it is necessary to pull a conclusion &amp; since my code is pretty short
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?
Using Windows 10, I can't run certain commands from PowerShell but they all work correctly using cmd. PowerShell: node --version: node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + node --version + ~~~~     + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException     + FullyQualifiedErrorId : CommandNotFoundException  node.exe --version: no output. node.exe: opens a new black console (node.exe application itself). Get-Host | Select-Object Version: Version ------- 5.1.19041.906  Get-Command node: The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + Get-Command node + ~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (node:String) [Get-Command], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand Get-Command node.exe: CommandType Name Version Source ----------- ---- ------- ------ Application node.exe 14.16.1.0 C:\Program Files\nodejs\node.exe $env:Path output has nodejs &amp; git &amp; other paths. cmd: everything works fine with any command. I have git and nodejs in my PATH env variable. What's wrong with PowerShell, what a strange behavior is this and how to fix it? Rationale behind pronunciation of "subtle" Why does $\lim_{n\to\infty}(1+\frac{1}{n})^n = e$ instead of $1$? On Wikipedia, it says that $\lim_{n\to\infty}(1+\frac{1}{n})^n = e$ :     It [e] is approximately equal to 2.71828,[1] and is the limit of (1 + 1/n)n as n approaches infinity, ... ()   When I evaluate $(1+\frac{1}{n})^n$ for $n = 10^8$, I get approximately $2.718281798347$ which indeed is pretty close to $e$.  But when I try to "solve" the limit using the laws of limits, I get  $$\lim_{n\to\infty}\left(1+\frac{1}{n}\right)^n = \left(\lim_{n\to\infty}\left(1+\frac{1}{n}\right)\right)^n$$  because of the power law  $$ = \left(\lim_{n\to\infty}(1)+\lim_{n\to\infty}\left(\frac{1}{n}\right)\right)^n$$  because of the addition law  $$=\left(1+0\right)^n = 1$$  but that would mean that $e=1$, which is obviously not true.  What am I missing / doing wrong?  Thanks in advance. How to check if a process is running via a batch script What is a decoupling capacitor (or smoothing capacitor as referred to in the link below)?  How do I know if I need one and if so, what size and where it needs to go?    mentions many chips needing one between VCC and GND; how do I know if a specific chip is one?   Would an  4-bit parallel access shift register used with an Arduino need one? (To use my current project as an example) Why or why not?  I feel like I'm starting to understand the basics of resistors and some places they're used, what values should be used in said places, etc, and I'd like to understand capacitors at the basic level as well. For one of the clients, I have spin up a modern communication site collection and on the landing page of the same, I am seeing 'Get the mobile app' showing up, I was able to hide the 'feedback' button using css but no luck with Get the mobile app button.  Can someone please share css to hide 'get mobile app' button, appreciate the help. How to retrieve the first n characters of a variable in Bash? Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc.  Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times.  I'm wondering if, and how, to clear the Python interpreter console.  I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do.  Note: I'm running on Windows, so Ctrl+L doesn't work. Is there any way to run file explorer as administrator under Windows 10 After install Windows 10, it seems that I lost the ability to run explorer.exe as administrator with a user in administrator group.   The reason I want to do that is, in our team's development environment, we are using a C# exe to do some environment configuration which will start command prompt under administrator mode and subst a drive. As a result those substed drives are not visible within the file explorer since it is run not as administrator. That will be kind of inconvenience and sometimes make mistakes.   I was able to run explorer.exe from task manager with the option "create with privileges" checked and then I can see all the drives in explorer. But now this is not working anymore.   I knew there are other options to workaround this workflow, but just want to make sure that if it is now totally impossible under Windows 10?  Any comment is appreciated. What is the time complexity of conjugate gradient method? I have been trying to figure out the time complexity of the conjugate gradient method.  I have to solve a system of linear equations given by  $$Ax=b$$  where $A$ is a sparse, symmetric, positive definite matrix.  What would be the time complexity of the conjugate gradient method? Find & Delete duplicated files on multiple harddisks at once How do I remove any Ubuntu brand and trademark from my Ubuntu install? If $X$ and $Y$ are independent $N(0,\sigma^2)$, then $X^2+Y^2$ and $X/Y$ are independent? If $X$ and $Y$ are independent, then $X^2+Y^2$ and $X/Y$ are independent? I was solving the problem for the case that $X$ and $Y$ are independent $N(0,\sigma^2)$.  So i found that $X^2+Y^2$ is negative exponential, $X/Y$ is Cauchy distribution. How can i prove that $X^2+Y^2$ and $X/Y$ are independent?  Also, what it will be if the case for general random variable $X$, $Y$ with  $X^2+Y^2$ and $X/Y$ are defined? Can I change directory to a Windows drive in Ubuntu Bash on WSL? I am a super newbie for Ubuntu and basically need Ubuntu for a Python package.  I would like to run a Python file in say e:/username/folder1/folder2/python.py. I tried every method online and the only reply is bash: cd./e: No such file or directory. I am not sure whether it is because of the bash windows or virtualenv.  When I use bash on Ubuntu on Windows, ls, it says VIRTUALENV_DIR. cd, it says /home/username. The cd .. etc changes the directory a little, but not another drive, nor the folder I would like it to find. How to convert decimal to hexadecimal in JavaScript How do you convert decimal values to their hexadecimal equivalent in JavaScript? Will something accelerate forever if a constant force is applied to it on a frictionless surface? If so how? I don't understand the fact that let's say hypothetically I was pushing a block on a frictionless surface, and I kept applying the same force on the object how it would keep accelerating! Wouldn't there have to be a certain velocity where it would stop getting faster? If not then what is actually acting on the object to cause it to accelerate infinitely? Creating square buffer around point feature using ArcGIS for Desktop? I would like to create a square buffer from a point feature but I do not understand the code that goes into it.   Similar questions have been asked on the forums.esri website but that was over 10 years ago, and it did not work when I tried the code.  How do I create a square buffer from a point feature? How to find web hosting that meets my requirements? This is a "catch-all" question designed to serve as an answer for all questions about choosing web hosting.  Pro Webmasters no longer accepts new questions about how to choose hosting.  All future questions pertaining to finding web hosting should be closed as a duplicate of this question. For more information about this policy please see .    How to find web hosting that meets my requirements?  What we're looking for in answers to this question are the basics about web hosting:   What is web hosting? What is the difference between shared, VPS, and dedicated hosting? How does a content delivery network relate to web hosting? Anything else you feel is helpful in finding a web host.   What we do not want is:   Endorsements or recommendations for specific web hosts We do not want your experience or other subjective information (just the facts please) How do I copy a property from an active object to selected objects? Should there be a comma in 'a 30-day, money-back guarantee'?