I am running a perl script and basic addition operators seem to be not working. For my code  print $total_charges," 1 \n"; print $payments," payments\n"; $total_charges+=$payments; print $total_charges," 2 \n";   For this code, the output is the following  10192.19 1 -401.99 payments 9790.20000000005 2   If you do the math, this number would be correct except for the extra decimal places. What is going on?  I need these numbers to be accurate. Any suggestions on fixing this, or do I just truncate to 2 decimals each time?
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
I have a batch file which is in a directory and must be run from there as well because it updates files within this directory. This works perfectly fine, except when the user runs the batch file as administrator (required on Vista). Then the starting directory is C:\Windows\System32. Is there any way to still be able to know from which directory the batch file was run? I dont want the user to enter the directory manually. I understand that the Istari - the only other Maiar besides the Balrog to come into close proximity to the Ring - are constrained within a mortal body and subject to its mortal weaknesses, which renders them vulnerable to the Ring's domination and corruption. However, what is to stop Gandalf from returning to his true form, picking up the Ring, and just walking all the way to Mount Doom? Sauron is too weak at the time; he would have been able to do nothing but watch helplessly and pray his mortal armies can defeat a Ring-bearing Gandalf.  Is Gandalf's decision to abide by the Valar's will to the end the only thing holding him back from this particular option? Are there enchantments in place to disable his ability to revert to Maia form, such that the option was never there to begin with? Or would he, even in Maia form and free of mortal weaknesses, still be vulnerable to domination and corruption by the Ring?  The One Ring is forged with the essence of Sauron to dominate and rule the minds of lesser beings. However, Sauron is only a Maia - albeit the highest-ranking in Morgoth's following. Fellow Maiar would be his equal (at least in rank), while the Valar are certainly superior in power to him. If an Ainu becomes a Ringbearer, will he/she eventually fall to Sauron's will too, or at least succumb to the corruption of the Ring's dark power? Prove that $A^*A + I$ is invertible Let $A$ be an $m\times n$ matrix. Prove that $A^*A + I$ is invertible.   I'm not sure what to do because everything I try ends up at $A^*A$ again and not $AA^*$. Gauss circle problem : a simple asymptotic estimation. How to calculate $\int_0^{\pi/2} \sin^a x \cos^b x \,\mathrm{d} x$ What is the best way to filter a Java Collection? I want to filter a java.util.Collection based on a predicate. How to apply multiple styles in WPF In WPF, how would I apply multiple styles to a FrameworkElement?  For instance, I have a control which already has a style.  I also have a separate style which I would like to add to it without blowing away the first one.  The styles have different TargetTypes, so I can't just extend one with the other. Continuous v. per-chapter/section numbering of figures, tables, and other document elements Some document elements (e.g., figures in the book class) are numbered per chapter (figure 1.1, 1.2, 2.1, ...). How can I achieve continuous numbering (figure 1, 2, 3, ...)?  And vice versa: Some document elements (e.g., figures in the article class) are numbered continuously. How can I achieve per-section numbering?  \documentclass{book}% for "vice versa" variant, replace `book` with `article`  \begin{document}  \chapter{foo}% for "vice versa" variant, replace `\chapter` with `\section`  \begin{figure} \centering \rule{1cm}{1cm}% placeholder for graphic \caption{A figure} \end{figure}  \end{document}   Bonus question: Is it possible to adjust the numbering of the sectioning headings themselves? Can I, e.g., switch from per-chapter to continuous numbering of sections in the book class? multiple regression and multiple comparisons Say I fit a multiple regression of p explanatory variables. The t-test will allow me to check if any single one of those is significant ($H_0: \beta_i = 0$). I can do a partial F-test to check if some subset of them is significant ($H_0: \beta_i=\beta_j=...=\beta_k=0$).  What I often see though is that someone gets 5 p-values from 5 t-tests (assuming they had 5 covariates) and only keeps the ones with a p-value &lt; 0.05. That seems a bit incorrect as there really should be a multiple comparison check no? Is it really fair to say something like $\beta_1$ and $\beta_2$ are significant but $\beta_3$, $\beta_4$ and $\beta_5$ are not?   On a related note, say I run 2 regressions on 2 separate models (different outcome). Does there need to be a multiple comparison check for significant parameters between the two outcomes?  Edit: To differentiate from the similar question, is there any other interpretation to the p-values besides: "B_i is (in)significant, when adjusting for all the other covariates"? It doesn't seem that this interpretation allows me to look at every B_i and drop those less than 0.5 (which is similar to the other post).   It seems to me that a sure fire way to test whether B_i and Y have an a relationship would be to get a correlation coefficient p-value  for each covariate and then do a multcomp (although that would definitely lose signal).  Finally, say I computed the correlation between B1/Y1, B2/Y1 and B3/Y1  (thus three p-values). Unrelatedly, I also did a correlation between T1/Y2, T2/Y2, T3/Y2. I'm assuming the correct Bonferroni adjustment would be 6 for all 6 tests together (rather than 3 for the first group and 3 for the second group - and thus getting 2 "semi"-adjusted p-values). Is there a way to set an "Adventure Mode Boundary" in Minecraft? Is there a way to set an "Adventure Mode Boundary" in Minecraft?  I am trying to create this village where players can spawn in, and then set out to explore the world and build and do normal minecraft stuff. I don't want them to destroy this village, so I want them to be in adventure mode when they are in the village and then switch them to survival when they leave, and vice-versa. When they return to the village, they get switched back to adventure mode.  In other words, I want to set an "Adventure Mode Boundary" to protect buildings. I am working without mods. I am hoping there is an simple way using command blocks. Propose a privilege to sit in the 500 reputation mark Can we continue to show the "Take a tour" banner after a user has created an account? When you view a Stack Exchange site without being logged in, you see a friendly banner, prompting you to take a tour and understand the features of the site:    This links off to a high quality resource that can help new users understand how the site works. However, the moment a user signs up to the site, this banner disappears from immediate view and hides itself as a link under the help menu.  My proposal is to continue showing this banner until one of the following conditions are met;   The user gets the "Informed" badge The user reaches a set amount of reputation (250 or 500 should be sufficient) The user chooses to hide the banner   This should increase the exposure of the tour to new users, who are the people who need the tour, rather than hiding it the moment a user signs up. What's wrong with these two cron jobs? I have the following cron jobs defined.  55  8   *   *   3   /usr/bin/php /home/mark/dev/processes/customClient/events.php &gt; /home/mark/dev/processes/customClient/events-`date +%Y-%m-%d --date='last Wednesday'`-`date +%Y-%m-%d`.csv 0   9   *   *   3   /usr/bin/echo 'The csv for last week, trying my hand at automatiging this' | /usr/bin/mutt &lt;emailaddress&gt; -s 'Events from `date +%Y-%m-%d --date='last Wednesday'`-`date +%Y-%m-%d`' -a '/home/mark/dev/processes/customClient/events-`date +%Y-%m-%d --date='last Wednesday'`-`date +%Y-%m-%d`.csv'   It seems to work properly if I run it the above command directly from the command line. But when I checked the running of the script this morning I got an e-mail stating (I'm paraphrasing because I accidentally deleted them) that the back ticks weren't closed properly. A few months ago I was telling high school students about Fermat's principle.   You can use it to show that light reflects off a surface at equal angles. To set it up, you put in boundary conditions, like "the light starts at A and ends at B". But these conditions by themselves are insufficient to determine what the path is, because there's an extra irrelevant stationary time path, which is the light going directly from A to B without ever bouncing off the surface. We get rid of this by adding in another boundary condition, i.e. that we only care about paths that actually do bounce. Then the solution is unique.  Of course the second I finished saying this one of the students asked "what if you're inside an elliptical mirror, and A and B are the two foci?" In this case, you can impose the condition "we only care about paths that hit the mirror", but this doesn't nail down the path at all because any path that consists of a straight line from A to the mirror, followed by a straight line to B, will take equal time! So in this case the principle tells us nothing at all.  The fact that we can get no information whatsoever from an action principle feels disturbing. I thought the standard model was based on one of those!  My questions are   Is this anything more than a mathematical curiosity? Does this come up as a problem/obstacle in higher physics? Is there a nicer, mathematically natural way to state the "only count bouncing paths" condition? Also, is there a "nice" condition that specifies a path in the ellipse case? What should I have told that student? Currently questions are added in a rapid pace to SO, so that new questions disappear very quickly from the homepage. It I want to see questions from my areas of interest I can do either:   Go to the tagged/my tags page, but then I will see the questions only according to the votes Supply a list of tags "x or y or z", but it seems the list is limited to 15 or 20 tags.   What I suggest is to have categories as grouping of tags - the .net category , java category , web development category , etc. It can also help new users to locate questions from their area of expertise they can answer. We can decide that a category can contain between 5 and 20  tags in order no to have too narrow or too broad categories (numbers were given just for the sake of argument) How do electric currents make light? In an incandescent light bulb, electrons flow through wires to the bulb, where is passes through a filament, and the filament lights up.  Does this work because of several high energy electrons losing some of their energy to disturb the electromagnetic field, creating photons? The electrons just leave the filament afterward and are replaced by more high-energy electrons from the negative terminal. Or does it work differently?  As a secondary question, is there a type of light bulb that directly converts electron flow to photons? Introduction to statistics for mathematicians What is a good introduction to statistics for a mathematician who is already well-versed in probability?  I have two distinct motivations for asking, which may well lead to different suggestions:   I'd like to better understand the statistics motivation behind many problems considered by probabilists. I'd like to know how to better interpret the results of Monte Carlo simulations which I sometimes do to form mathematical conjectures.   I'm open to the possibility that the best way to go is not to look for something like "Statistics for Probabilists" and just go to a more introductory source. Prove or disprove: if $\sum\limits_{n=0}^∞a_n$ converges and $\lim\limits_{n\to\infty}b_n =0$, then $\sum\limits_{n=0}^{\infty}a_n b_n$ converges. Correlated joint normal distribution: calculating a probability Given   $$ f_{XY}(x,y) = \frac{1}{2\pi \sqrt{1-\rho^2}} \exp \left( -\frac{x^2 +y^2 - 2\rho xy}{2(1-\rho^2)} \right) $$  $Y = Z\sqrt{1-\rho^2} + \rho X$  And   $$ f_{XZ}(x,z) = \frac{1}{2\pi } \exp \left( -\frac{x^2 +z^2}{2} \right) $$  Show that $P(X&gt;0,Y&gt;0)= \frac{1}{4}+\frac{1}{2\pi}(\arcsin \rho) $  I'm supposed to use the fact that X and Z are independent standard normal random variables, but I don't quite understand how. Any help would be greatly appreciated. As much as I have tried, it doesn't seem possible to use separate labels when using a casesconstruction (from the amsmath package).  Ideally, I would like to be able to write something like  \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} f(x)=\begin{cases}   1&amp;x\geq0\label{positive}\\   0&amp;x&lt;0\label{negative} \end{cases} \end{equation} \end{document}   and later refer to both cases at different places. What would be the best way to achieve this result?