I'm solving cs50 pset1, I need first 2 decimal places. I'm trying to get it by converting the float I get from the user to int, then substracting it from float and then multiplying by 100 to get 2 decimal places  for ex input 9.41 after subustracting i get .410000 but when multiplying by 100 i get 40.9999 as output whereAS I need exact 41 so i can convert to int      #include&lt;stdio.h&gt;     #include&lt;cs50.h&gt;     #include&lt;math.h&gt;      int main(void)     {         int i = 0;         float number = get_float("Enter change: ");         printf("%f \n",number);         int integer = (int)number;         printf("%i \n",integer);         float change = number - integer;         printf("%f \n",change);         change = change * 100;         printf("%f \n",change);         int n = (int)change;          printf("%i \n",n);     }   expected:   Enter change: 9.41 9.410000  9  0.410000  41.000000  41    actual:  Enter change: 9.41 9.410000  9  0.410000  40.999985  40
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
Too big addon list, what should I do? How expand names and keep it all? Do I need to use The Loop on pages? I'm writing my first WordPress theme and have a question about the use of The Loop in page templates. The page templates I've looked at all follow basically the same pattern (example from Twenty Twelve):  &lt;?php while ( have_posts() ) : the_post(); ?&gt; &lt;?php get_template_part( 'content', 'page' ); ?&gt; &lt;?php comments_template( '', true ); ?&gt; &lt;?php endwhile; // end of the loop. ?&gt;   But a page will only have one post associated with it so iterating through the posts seems unnecessary. My page template is more readable and seems to work fine:  &lt;?php the_post(); the_title('&lt;h1&gt;', '&lt;/h1&gt;'); the_content(); ?&gt;   Is this a good practice? Are there any downsides? Correcting for multiple kruskal wallis tests I am running a kruskal wallis test a number of times (37) and wanted to know if I have to adjust the p-values of the kruskal tests before I look any further into the post hocs? What is "superuser" and how do I get that privilege? Conditional Number Formatting In Java Where is the dimensions option? Microsoft Excel mangles Diacritics in .csv files? Showing $\sum_{i = 1}^n\frac1{i(i+1)} = 1-\frac1{n+1}$ without induction? I oversaw a high-school mathematics test the other day, and one of the problems was the following     Show, using induction or other means, that $$\sum_{i = 1}^n\frac1{i(i+1)} = 1-\frac1{n+1}$$   The induction proof is very standard, where the induction step relies on the fact that $\frac{1}{n+1} + \frac{1}{n(n+1)} = \frac{1}{n}$, and I'm sure it's been answered on this site before. However, I got intrigued by the "or other means" part of the question.  I don't know whether the teacher who wrote the test even considered any alternative solutions (he may just have written it so that if anyone has a crazy idea that works out, then they should get a full score for it), but I tried to find one. For instance, we may do the following telescope-ish argument: $$ \frac{1}{1(1+1)} + \frac{1}{2(2+1)} + \cdots + \frac{1}{(n-1)n} + \frac{1}{n(n+1)} + \frac{1}{n+1}\\ = \frac{1}{1(1+1)} + \frac{1}{2(2+1)} + \cdots + \frac{1}{(n-1)n} + \frac1n\\ \vdots\\ = \frac{1}{1(1+1)} + \frac12\\ = 1 $$ However, I feel that this is just an induction proof in disguise (hidden in the vertical dots). If one uses the mechanics of the induction proof to check whether the formula is true for a specific $n$, then one certainly does the exact same calculations as I have done here.  Is there a proof of this fact that clearly does not use induction (or at least hides it better)? The more elementary the better, and the ultimate goal would be to do it within the syllabus of the students taking the test (or at least not far from it). For reference, they should be familiar with the summation formula of arithmetic and geometric series and their derivations (so techniques resembling those would be well within specifications).  If there is a solution using calculus, then the students should be able to integrate elementary trigonometric functions, as well as exponential functions, logarithms and rational functions. They are familiar with integration by parts, substitution and partial fractions.  I welcome more advanced solutions as well, of course. I messed up my system earlier, I was greeted with a black screen, when booting in to Ubuntu. When I started up my laptop, I selected the recovery option from the grub menu, and chose fallback at root terminal. I saw that I was able to use the add user command, with it, I probably could use to create a privileged user on my machine.   Isn't that a security issue?  One could have stolen my laptop and at startup chose recovery and add another user, I'm fudged then. Including my data.  Come to think of it, even if you somehow remove that entry, one could boot from a live-CD, get a chroot up and running and then add another user, with the right privileges that allows it to see all my data.   If I set the BIOS to boot at my HD only, no USB, CD/DVD, Network startup, and set a BIOS password, it still wouldn't matter, because you'd still have that grub recovery startup entry.  I am fairly certain that someone from China, Russia can't hack my Ubuntu Trusty Tahr, from the network, because it's secure like that. But, if one has physical access to my - your - machine, then, well, that's why I'm asking this question. How can I secure my machine so that hacking through physical access is not possible?    Bug Report: update-initramfs missing /lib/modules/4.4.0-13-generic In the Final Battle, when you remove doom tokens for rolling successes against an Ancient One do you stop counting successes for that roll? In Arkham Horror you have to roll a cumulative number of successes equal to the number of players to knock off a doom token from the Elder God's health. If you reach the number of players worth of successes do you then stop counting for the player and move on or do you count the extra successes against the next doom token?  We played it so that you kept on adding them but it meant that we turned Nyalothotep into mince meat quite quickly (One Character was blessed had a fight of 6 a shotgun and Fight +1 skill card though) How to sort a ConcurrentSkipListMap by value? I have recently installed Ubuntu 14.04 LTS on my laptop Sony Vaio VPCEA16FG. I have been getting system freezes (everything including display, mouse, keyboard stops working and I have to do a restart with the power switch) and there are random popups of "System program problem Detected"  On startup my screen is all splashed with black and white pixels and a System program problem detected message.  My video card info:    01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Madison [Mobility Radeon HD 5650/5750 / 6530M/6550M I'm trying to fill out the skills section on my first character, but when I look at the character sheets in the Starter Set as examples of how to make a character, the skills that are circled have higher modifiers than their Dexterity or Strength or whatever should make them.  I've filled out all skills but those. What do I add to the ability modifier to get those numbers?   My abilities are Strength 13, Dexterity 14, Constitution 11, Intelligence 15, Wisdom 8, and Charisma 8. Proficiencies are Arcana, Athletics, History, Investigation and Stealth. My saving throws are Strength and Dexterity.   I just started D&amp;D and have the Player's Handbook, DM's Guide, Monster Manual, and the Starter Set. Declare a global variable in a Blender session We built our eCommerce web site using Angular as a single page application.  We have implemented a spinner that runs until the page is responding with the expected content. We have some category pages which were crawled and indexed by Google but which are no longer available on the site. What is the best practice for old pages?  Should I create &quot;404 Not Found&quot; pages for them instead of saying &quot;loading&quot; forever? Is setting a no index meta tag enough? Calling a function from a string in C# Isomorphism between two models of Hilbert's Axioms with different notions of congruence Would the One Ring have stayed hidden if Bilbo hadn't turned up? How to check the count of .txt files in a folder (dir command)? How can use dir command to check how many .txt files there are in a folder (for example,  C:\Temp\)?