Computing float to 2 digits only (not formatting/rounding off 6 digits after decimal to 2)
Is there a function to round a float in C or do I need to write my own?
Let's say I have two planets that are one hundred thousand lightyears away from each other. I and my immortal friend on the other planet want to communicate, with a strong laser and a tachyon communication device.  I record a message on the tachyon communication device and release the message at exactly the same time as I activate the laser, both of which are directed to the other planet which is one hundred thousand lightyears away. Say it is the year 0 for both of us at the time I did this.  If tachyons existed, then the message would arrive to my friend before the photons in the laser. It would arrive, say, a thousand years earlier. From my vantage point, that message will arrive to her at year 99,999; the same would be true for my friend's vantage point. However, she will only see the laser at year 100,000.  So since she got the message at year 99,999, she immediately sends me a reply back going through the same procedure as I did. She records a message and releases it at the same time as the laser. The tachyons will arrive 1,000 years earlier than the laser, so for me, I will receive the message at year 199,998. I will receive the laser, however, at year 199,999.  It seems to me that communication this way does not violate causality. I will still have received the message after I had sent it.   If tachyons truly violated causality, though, I realize it should arrive at year -1 for her, and so she can reply to me at year -2, which would mess me up by year 0 as I will ask her how she knew I was planning on sending her a message before I sent it. I could send her a different message, which she would end up receiving at year -1, and will end up confusing her as she would have received one message asking her out, and the other asking her how did she know I was asking her out. She then decides I am crazy and sends me a message at year -2 that she does not want to date me, and so she will have both turned me down and entertained me before I have even asked her out.  On the other hand, let's go back to year 0 and add a third device to our list: an Alcubierre drive. After I send out the message and the laser, I get impatient and do not feel like waiting 99,999 years, so I get on my Alcubierre drive spaceship and arrive on her planet at the same year 0. My friend is not in her office, so I leave a note to her also immortal secretary saying I dropped by and that she should expect a message for her in year 99,999.  I then get back on my Alcubierre drive and land back on my planet, still on year 0. Meanwhile, the tachyons and photons I sent out are still racing to arrive to her. By year 99,999, she receives the message just as I Alcubierre drive back to her, and I pick her up for dinner.  But the point of my question is, it seems to me that just going faster than light, if that alone was what you had, would not violate causality. It must be something else. I understand time dilation and that things with mass cannot travel at the speed of light, but using the Alcubierre drive, hypothetically speaking, I was still able to outpace the photons while also having mass. It still did not produce causality problems. Alcubierre drives are also valid solutions to GR.  It seems circular to me to say that what makes traveling faster than light violate causality is because it violates causality (if faster than light communication was divorced from causality problems, then the causality problem would cause itself -- thereby violating causality and, hence, we would scrap it and conclude that there is no causality problem after all).  What is it that I am missing? If someone could help me out, that would be excellent. I've been itching to ask my friend out for a few millenia now. :) How do I check the series $\sum_{n=2}^{\infty} \frac{(-1)^n }{n+(-1)^n}$ for absolute convergence/conditional convergence ?  How can I solve this problem? Under what circumstances will a passive HDMI-to-VGA adapter work? I have bought a no-brand, passive HDMI Male to VGA Female adapter, to link up a PC with a more dated monitor. It did not work.  After doing some reading, I have learned that buying such an adapter is often discouraged because in many cases it will not convert the signal from Digital to Analog, or the Motherboard/CPU on a specific computer might not be compatible with that particular adapter.   So my question is: seeing how there are so many of these passive adapters on the market, are there circumstances under which they actually do suffice to connect an HDMI output to a VGA input? Or are they generally just a rip-off?  Example of the kind of adapter I bought: Where are the outliner toggles in 2.8? Virtual box is not working on windows 10 multiline command chunks in bash history into multiple lines In Bash (as well as Bash in WSL), multiline written commands can call-back with up/down arrows correctly also built-in history command report them correctly (until I'm still logged-in in bash). But after exiting from bash and press up/down arrows, multiline commands appears each as separate entries and that's because cat ~/.bash_history has chucked the command on multiple separate entries and writing problem here; the history command result messed too. I have set these options in ~/.bashrc shopt -s cmdhist lithist HISTTIMEFORMAT='%F %T '  and now writing problem fixed but history command still report in multiple line and separate entries (reading problem now). Bash version is 4.3, same issue on v4.4 there is  since a long years but no solution yet. Update: it's also to mention that below multiline command as an example is correctly displaying even after exit Bash: for i in {1..10} do echo $i done  but this is failing: awk ' { print $1}' &lt;&lt;&lt;'first last'  Update 2: the issue mentioned above is fixed in Bash v5.0.0+ that changed to recognize entries between &quot;timestamp as delimiter&quot; as single entry of command (HISTTIMEFORMAT, cmdhist and lithist must be set). how to get full path from fileupload using Javascript What is the difference between an "API," a "framework," an "IDE," and an "engine?" I am just starting out trying to learn to develop games. At first I thought C++ and OpenGL were the tools a beginner would start out to make a game, but quickly found out the OpenGL was just a API for graphics. Then I thought C++ and SFML were what I needed to learn to make a game, but found out the SFML was a media framework that could be used to make games but wasn't a game engine.  I don't want to use a software that does all the work for me, I want to code my own game, the way a game programmer would. I don't understand the difference between a IDE, framework, API, and a engine; What separates them from each other? Do some game programmers use the SFML framework, while other programmers use a game engine? Using Gimp to batch convert images to another format in Windows As implied by the title, does anybody know how to use the gimp-console-[version].exe program to batch convert images between formats (with default settings) in Windows ? Get selected value in dropdown list using JavaScript System of congruences with variable I am looking over , and I came across a solution containing this:  Problem Bernardo chooses a three-digit positive integer $N$ and writes both its base-5 and base-6 representations on a blackboard. Later LeRoy sees the two numbers Bernardo has written. Treating the two numbers as base-10 integers, he adds them to obtain an integer $S$. For example, if $N = 749$, Bernardo writes the numbers $10,\!444$ and $3,\!245$, and LeRoy obtains the sum $S = 13,\!689$. For how many choices of $N$ are the two rightmost digits of $S$, in order, the same as those of $2N$? $\textbf{(A)}\ 5 \qquad\textbf{(B)}\ 10 \qquad\textbf{(C)}\ 15 \qquad\textbf{(D)}\ 20 \qquad\textbf{(E)}\ 25$ Solution 1 First, we can examine the units digits of the number base 5 and base 6 and eliminate some possibilities. Say that $N \equiv a \pmod{6}$ also that $N \equiv b \pmod{5}$ Substituting these equations into the question and setting the units digits of $2N$ and $S$ equal to each other, it can be seen that $b &lt; 5$ (because otherwise $a$ and $b$ will have different parities), and thus $a=b$. $N \equiv a \pmod{6}$, $N \equiv  a \pmod{5}$, $\implies N=a \pmod{30}$, $0 \le a \le 4$ Therefore, $N$ can be written as $30x+y$ and $2N$ can be written as $60x+2y$ Just keep in mind that $y$ can be one of five choices: $0, 1, 2, 3,$ or $4$, ; Also, we have already found which digits of $y$ will add up into the units digits of $2N$. Now, examine the tens digit, $x$ by using $\mod{25}$ and $\mod{36}$ to find the tens digit (units digits can be disregarded because $y=0,1,2,3,4$ will always work) Then we take $N=30x+y$ $\mod{25}$ and $\mod{36}$ to find the last two digits in the base $5$ and $6$ representation.[N \equiv 30x \pmod{36}][N \equiv 30x \equiv 5x \pmod{25}]Both of those must add up to[2N\equiv60x \pmod{100}] $N\equiv{30x\mod{36}}\\N\equiv{30x}\equiv{5x\mod{25}}$ Both of these must add up to $2N\equiv{60x\mod{100}}$ [...]  I'm not really sure which modular arithmetic rule to apply in the final three congruences, or where to start. How would I go about understand this? What is a primary decomposition of the ideal $I = \langle xy, x - yz \rangle$? Was mathematics invented or discovered? What would it mean to say that mathematics was invented and how would this be different from saying mathematics was discovered?   Is this even a serious philosophical question or just a meaningless/tautological linguistic ambiguity? Mach-O 64-bit format does not support 32-bit absolute addresses. NASM Accessing Array Uncountable well ordered set in $Z^-$ theory. I want to build an uncountable well-ordered set within the theory $Z^\textbf-$. So, I take $A=\omega$ (exists by infinity axiom) and define $$W:=\{(X,R)\in\mathcal{P}(A)\times\mathcal{P}(A\times A):\langle X,R\rangle\ \text{is a well-ordered set}\}$$  With this I consider the set $T:=W/\cong$ (where $\cong$ is isomorphism relation). Note that $W$ and $T$ are sets by power set axiom. So I define for each equivalence class $[x],[y]\in T$ the order  $$ [x]\leq_T[y]\Leftrightarrow \text{type}(x, R_x)\leq \text{type}(y,R_y) $$  Here, $R_x$ means the order of $x$ that make it belongs to $[x]$.   So, $T$ is well ordered by $\leq_T$ and it is uncountable.  Question: I don't pretty sure if I can build $\leq_ T$ without replacement axiom. Another doubt is, Can I take the $R_x$ without AC? Why is the console window closing immediately once displayed my output? Constrains relationship I have the following design. Each user has it's own contacts, it's own hosts and assign those to a domain which belongs only to him.   I want to insure that the host you assign to the domain belongs to the user that domain is assigned to.  Is it something that I have to insure in my application logic?  If I set domains.user_id foreign key to reference host.user_id and user_id.id does it eliminate my issue?    By the way can anyone suggest me a better design for my schema? I am dissecting some code and came across this,   $sql = 'SELECT page.*, author.name AS author, updator.name AS updator '      . 'FROM '.TABLE_PREFIX.'page AS page '      . 'LEFT JOIN '.TABLE_PREFIX.'user AS author ON author.id = page.created_by_id '      . 'LEFT JOIN '.TABLE_PREFIX.'user AS updator ON updator.id = page.updated_by_id '      . 'WHERE slug = ? AND parent_id = ? AND (status_id='.Page::STATUS_REVIEWED.' OR status_id='.Page::STATUS_PUBLISHED.' OR status_id='.Page::STATUS_HIDDEN.')';   I am wondering what the "?" does in the WHERE statement.  Is it some sort of parameter holder? babel shorthand "| doesn't work in macros The package babel with the ngerman option (and most other languages as well, but not english) provides the shorthand "|, which prevents a ligature at the given position (see p. 81 of the , e.g. Auf"|lage will result in the word Auflage without an fl-ligature (as is desired because, in German, you don't want ligatures across morpheme borders).  However, when placed in a macro, "| doesn't work anymore. Why is this and how can I circumvent it?  \documentclass{article}  %\usepackage[T1]{fontenc}% doesn't help \usepackage[ngerman]{babel}  \newcommand{\foo}{"|}  \begin{document}  ff  f"|f  f\foo f  \end{document} Here is some information we got : We know the value of $n$, with size $1043$. We know the value of $p$ (size $20$) and $q$ (size $1023$) as the factors. $e = 65537.$ $\varphi(n)$ = $(q-1)(p-1)$ When I calculated $\gcd$ and $\text{modinv}$, I got : $\gcd(e,\varphi(n)) = 65537$ $modinv(e,\varphi(n)) = 1 $ So we can tell that they are not relatively prime. So, how to compute the d, and get the value of m? I'm not that good with math, so I cant understanding well the theory. so can anyone please make an example implementation or write a clear formula?