The Python round() function will theoretically take negative numbers to round to places left of the decimal. [ I.e. round(150, -2) => 200]   However, it seems to be very susceptible to floating point error.  For example, given a large number say 2e25, it gives weird results.  2e25 === 20000000000000000000000000  But, round(2e25, -23) gives a value like 20000000000000000273942742  When it should just be getting 20000000000000000000000000  I know there's a formatting function, a la this thread:   However, that only seems to work for rounding to the right of the decimal.  Am I wrong?  Is there another way to do this?  Very frustrating trying to get the math right.  Thanks!
The documentation for the  function states that you pass it a number, and the positions past the decimal to round. Thus it should do this:  n = 5.59 round(n, 1) # 5.6   But, in actuality, good old floating point weirdness creeps in and you get:  5.5999999999999996   For the purposes of UI, I need to display 5.6. I poked around the Internet and found some  that this is dependent on my implementation of Python. Unfortunately, this occurs on both my Windows dev machine and each Linux server I've tried. .  Short of creating my own round library, is there any way around this?
Why do I get TypeError: can't multiply sequence by non-int of type 'float'? How to prove that this set is closed? Suppose $Y$ be an ordered set in the order topology. Let $f, g: X \to Y$ be continuous. How to show that the set $\{x| f(x) \leq g(x)\}$ is closed?  This is a excercise from munkres. Maybe trying to show that the set $f(\{x| f(x) &gt; g(x)\})$ is open is suffice. But I could not figure out the connection between this set and the continuity of the two functions.Could you give a hint?  Thanks. SELECT permission on view querying table from another database Firefox Web Console Disabled? Notice: Undefined variable: logged in C:\xampp\htdocs\Site\Site\view_category.php Why do I see a saddle in this picture of a computer screen? I am not entirely sure this is an appropriate question for PSE, however since many of you have such diverse backgrounds, I'll give it a shot.  I have noticed that when one takes a picture of a computer, TV screen with a phone, you can "see" what looks like a saddle phase portrait.     Why does this happen? Does it have any relevance to differential equations or other areas of math? How is momentum conserved in this example? Unable to change payment information to NONE in iOS Appstore Ever since adding an iTunes gift card to my account, I'm getting verification requests like crazy. I can't even download free apps. It takes me to my payment info and when I try to select none, I continually get a message under the payment info that says "you must verify your payment info to continue"  I don't want a credit card on file and would really like the none option to work. My ID shows I still have iTunes credit. reference overlay numbers with names Is "I am sat" bad English? I believe it is incorrect and instead either the present continuous     I am sitting   or the predicate adjective     I am seated   should be used.  I hear this quite often, however, and ultimately usage overrules formality.  Does anybody know where this originated or how to describe it grammatically? A diagram which is not the torus At page 17 of Munkres' Elements of Algebraic topology it says, referring to fig. 3.6, that "the diagram does not determine [the torus]. It does more than paste opposite edges together":   Is it so? I tried to glue them together, but end up with a normal torus. In CodeGear Delphi 2007, how can I turn specific warnings and hints off? I am attempting to turn off H2077 - Value assigned to 'varname' never used. Proving with induction $(1-x)^n<\frac 1 {1+nx}$ Prove using induction that $\forall n\in\mathbb N, \forall x\in \mathbb R: 0&lt;x&lt;1: (1-x)^n&lt;\frac 1 {1+nx}$   My attempt:   Base: for $n=1: 1-x&lt;\frac 1 {1+x}\iff 1-x^2&lt;1$, true since $0&lt;x&lt;1$.  Suppose the statement is true for $n$, prove for $n+1$:  $(1-x)^{n+1}=(1-x)(1-x)^{n}\overset{i.h}&lt;\frac{(1-x)}{1+nx}$  Now I got stuck, maybe another induction to show that $1+nx+x&lt;1+nx$? Is there another way?  Moreover, I was told it's wrong to begin with $(1-x)^{n+1}$ and reach to $\frac 1 {1+(n+1)x}$ but why? Is it assuming what I need to prove? failed to create symbolic link ‘/usr/bin/utserver’: File exists What are underfull hboxes and vboxes and how can I get rid of them? Is there a NumPy function to return the first index of something in an array? I know there is a method for a Python list to return the first index of something:  &gt;&gt;&gt; l = [1, 2, 3] &gt;&gt;&gt; l.index(2) 1   Is there something like that for NumPy arrays? I've often heard that Einstein shattered the notion of absolute motion (i.e. all things move relative to one another) and that he established the speed of light as being absolute. That sounds paradoxical to me; I cannot understand how the two concepts can be reconciled.  Before going further, I'd like to say: 1) Over the years, I've seen many layman's explanations on these topics (including the nice YouTube video by Vsauce, ). I understand everything that's said (or, at least, I think I do). Just nothing I've found seems to address this apparent contradiction. 2) More recently, I've tried to find the answer on my own. That includes searching the posts on this site. Some come close (), but nothing I've been able to find seems address specifically what I'm asking.  Back to the question: Relativity shows us that there is no universal frame of reference by which to judge motion, so object A might be reckoned as moving at 10&nbsp;m/s relative to object B or as stationary relative to object C. This is fine for me. I can grasp that the universe has no intrinsic coordinate system, that we only think that way on Earth because we have the ground to move over.  Then there's the speed of light (in a vacuum). The speed of light is the ultimate "speed limit," it's often said. But if there is no universal frame of reference, how can there be any such speed? The very idea only make sense if there is a universal frame.   If one object is moving (uniformly) at 60%&nbsp;c and another object is also moving at 60%&nbsp;c, but in the exact opposite direct, then from the perspective of either one (if they could still see each other) the other would appear to violate that speed limit. All these spacetime bending consequences used to explain why nothing can move past this speed only seems to enshrine the concept that there is some ultimate speed standard. If there is only relative speed, then the concept of light having a specific speed in the vacuum should be a nonsensical one since it having speed (x m/s) would only make sense when measured against some other body.   Since I was very young, it has always sounded to me like motion is only mostly relative, that until you get close to the speed of light, the effects of an absolute frame of reference are negligible. Perhaps that there is an actual fabric of space which everything moves relative to, which is why there is something to expand between galaxies (faster than light can propagate) in the metric expansion of space. Growing up, I always thought this would just start makes sense with time. Now I'm up to a first year (college) level in physics, I even know basic calculus, yet I'm still hopelessly confused.  EDIT:  Thank you to whoever suggested this may be a duplicate of . It and others are very much related and at least partially answer my question. Unfortunately, explaining that distances become shorter and time becomes slower as a way to stop you from exceeding the speed of light does not explain how that speed is not an absolute.  By my reckoning, if all speed is relative, then no matter how fast you go light should always race away from you at the same apparent speed. I.e. there should be no speed limit. For there to be a speed which you cannot exceed or you would catch up (and make time irrelevant) requires the very concept of some external speed by which light can travel and nothing else can reach - thus my logical paradox continues unabated. Is it possible to increase Output Field Name length beyond 10 characters? When creating a new Column, the default value for the length of the name is 10. Using the Field Calculator via the Model Builder, I want to include the names of regional areas into the columns which has more than 10 characters.  Can the length of the Output Field Name be increased? C# Mono - Low Level Keyboard Hook I'm using code that I found on the .  The only problem is it uses external DLL calls that don't work in mono.  I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono?  Edit:  Clarifying what I'm trying to do: I'm making a .  The program sits in the system tray and when the user presses the hot-key, it will pop up all the gadgets.  So the program doesn't have focus, so typically it won't catch any keystrokes, so I'm using the low-level keyboard hook and I hook the two keys that the user defines as the hot-keys.  But I'm using a Windows DLL call for that, which doesn't work in Linux using mono.  So I'm wondering if there's a way to do the same thing, but will run in Linux using mono? Why didn't Harry himself drink Polyjuice Potion instead of all others in Deathly Hallows Part 1? In Harry Potter and the Deathly Hallows Part 1, it is shown that members of the Order of Phoenix come to rescue Harry from his house at Privet Drive. There, they all drink Polyjuice Potion and assume the form of Harry to confuse death eaters in identifying who is the real Harry.  An obvious, more safe, better choice would be to change Harry into someone else. Maybe a muggle, like his cousin Dudley. And then, safely take him to the Weasleys, maybe apparating. That way, death eaters won't ever find out. Isn't that correct?  Why didn't they take this path, and follow a rather complicated and risky one?