Basically i tried to output a double variable with but only PrintDigit(char ). Here is my code  void    printDigit(const char c) { cout &lt;&lt; c ; }  void    PrintDigits(double target) {     if (target &lt; 0)     {         printDigit('-');         target = -target ;         PrintDigits((int)target / 10);     }     else if ((int)target / 10 == 0)     {         printDigit('0' + (int)target % 10);         if (target - (int)target % 10 != 0)         {             target -= (int)target % 10;          do {             target *= 10 ;             //for debugging             cout &lt;&lt; endl &lt;&lt; target &lt;&lt; endl;             cout &lt;&lt; floor(target)&lt;&lt;" "&lt;&lt;ceil(target)&lt;&lt;endl;         } while (floor(target) != ceil(target));          printDigit('.');         PrintDigits(target);     } }   }  And there are some strange problems ,here is the output when i tried to input 3.53:   My question is why floor(target)==52 while target==53 ? And is there any better way to do this ?(with only PrintDigit(char) function and don't transfer the double variable to string)
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
How to "Hide a Collection in viewport" but not "Disable in Viewport" via script in Python Hi Blender coders and artists.  I am updating one of my add-ons for Blender 2.8 and have run into some  issues finding the appropriate way to hide a collection that is added to my scene.  I want to deselect the eyeball on the toolbar with a python command in a script but I don't want to disable the collection in the view-port entirely as it is used as a collection in a particle system.   I just want to deselect the eyeball circled in green below.  Anyone know the python API for this? Stop asking me if Community auto-flags were helpful I used to be able to color code each folder in Finder.   I know I can use tags in Mavericks, but is there a way to restore the ability to actually color code folders?  Thanks. Is there an algorithm to decide if a symlink loops? Unix systems usually just error out if they are confronted with a path that contains a symlink loop or just too many symlinks, because they have a limit to the number of symlinks they will traverse in one path lookup. But is there a way to actually decide if a given path resolves to something or contains a loop, even if it contains more links than a unix is willing to follow? Or is this a formally undecidable problem? And if it can be decided, can it be decided in a reasonable amount of time/memory (e.g. without having to visit all files on a filesystem)?  Some examples:  a/b/c/d where a/b is a symlink to ../e and e is a symlink to f and f is a symlink to a/b  a/b/c/d where a/b/c is a symlink to ../c  a/b/c/d where a/b/c is a symlink to ../c/d  a/b/c/d where a/b/c is a symlink to /a/b/e where a/b/e is a symlink to /a/b/f where a/b/f is a symlink to /a/b/g   Edit:  To clarify, I am not asking about finding loops in the file system, I am asking about a decision algorithm that decides of a given path whether it resolves to a definite file/directory or whether it does not resolve at all. For example in the following system, there is a loop, but the given path still resolves fine:  / -- a -- b where b is a symlink to /a   This directory tree clearly has a cycle, but the path a/b/b/b/b/b still resolves fine to /a. One may not always know the Type of an object at compile-time, but may need to create an instance of the Type.    How do you get a new object instance from a Type? Equation numbers are shown in reverse parentheses I am using   \begin{equation} a = b \end{equation}   to write the equations in my paper. However, the problem is that the number related to each equation is not shown in the correct format like the picture   How can I fix this?  This is what I have at the first of my code:  \usepackage{graphicx} \usepackage[justification=centering]{caption} \usepackage{float} \usepackage{url}% typeset urls \usepackage{times} \usepackage{url} \usepackage{latexsym} \usepackage{fontspec} \usepackage{multirow} \usepackage{listings} \usepackage{setspace} \usepackage{listings} \usepackage{fontspec} \usepackage{amsmath} \usepackage{polyglossia} \usepackage{color} \usepackage{bidi} \newfontfamily\faFont[Script=Arabic]{Yas}  \newenvironment{Fa}{\begin{RTL}\faFont}{\end{RTL}} \newcommand{\fa}[1]{{\faFont\RL{#1}}} \newcommand\Mark[1]{\textsuperscript#1} \definecolor{backcolour}{rgb}{0.95,0.95,0.92} \definecolor{darkblue}{rgb}{0.95,0.95,0.92} \setmainlanguage{english} \setotherlanguage{farsi} \newfontfamily\farsifont[Script=Arabic]{Yas} I know enough amount of set theory and logic to study grad-level math. However, I don't know more advanced set theory and logic, such as the ones on Kunen's or Shoenfield's texts. Although it's good to learn such advanced topics, I may not have enough time to do so, since I will probably put my emphasis on algebra, analysis or geometry as well as mathematical physics.   Although how much set theory and logic I should learn is totally up to what sort of analysis, algebra or geometry I will study, I want to know how much of them typical competitive algebraists/analysts/geometers know. If you are one of them, how much do you know? Problem with option border of class standalone I tested a MWE given in question . Following the documentation (page 9) I used the class option border={left right bottom top} with left=right=top=0pt and bottom=20pt (20pt only to show the effect here).  With the version 2012/09/15 v1.1b of standalone and the following MWE I get no 20 pt margin at the bottom of my picture.  What is the problem?  MWE:  \documentclass[% % border=1pt   border={0pt 0pt 20pt 0pt} %left right bottom top ]{standalone}% http://ctan.org/pkg/standalone \begin{document} $2^5 = x_5 \times y^8$ \end{document} How to find an unknown Steam User I was playing with someone on Ark: Survival recently, I CTD'd and couldn't get his information. Are there any means that I could find this user's Steam account even though he hasn't logged in since?  I know of the function View: Players in Steam, but it only shows me the last 24 hours and I haven't played with this player in 3-4 days. Is there a way I could extend the view recent players function on Steam? Is there a record of this somewhere? Or do I have any further options? Where to put my code: plugin or functions.php? Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php?  There    and many  about that topic, mostly because there are some misconceptions about the inner workings of WordPress. I am asking for an answer based on facts, not on opinions.  It should explain how to handle these points (and probably more):   custom post types and taxonomies contact forms shortcodes custom widgets  SEO functions like custom meta elements theme switch   There are often pros and cons for both sides. Our most popular question  got a lot of code snippets as answers that are at least debatable. We need criteria a beginner can understand, maybe a check list – with reasons.  See also the related question by Chip Bennett on our meta site:   Related: Handle application exit When using wish to replicate a spell, what school of magic does it count as? How to get perfect UV sphere Mercator projection? I'm trying to unwrap a UV Sphere and I can't seem to get a perfect  projection. What process should I follow to get a perfect UV unwrap that looks like the black grid lines in this image?: Story about a future with races How to define a figure size so that it consumes the rest of a page? Sometimes I don't need to have a specific picture size, but for layout reasons I would like to scale the image so that the rest of the page is filled. How can I achieve that? Blender 2.80 AV Sync missing? I just installed Blender 2.8 and for the life of me I can not find AV Sync anywhere and video editing has become impossible. Is there some new setting I am unaware of? Proof of properties of injective and surjective functions. I'd like to see if these proofs are correct/have them critiqued.     Let $g: A \to B$ and $f: B \to C$ be functions.  Then:   (a) If $g$ and $f$ are one-to-one, then $f \circ g$ is one-to-one.   (b) If $g$ and $f$ are onto, then $f \circ g$ is onto.   (c) If $f \circ g$ is one-to-one, then $f$ is one-to-one?   (d) If $f \circ g$ is one-to-one, then $g$ is one-to-one?   (e) If $f \circ g$ is onto, then $f$ is onto?   (f) If $f \circ g$ is onto, then $g$ is onto?     (a)  Let $a,b \in A$.  If $(f \circ g)(a)=(f \circ g)(b)$, then $f(g(a))=f(g(b))$.  Since $f$ is one-to-one, we know that $g(a)=g(b)$.  And, since $g$ is one-to-one is must be that $a=b$.  Hence $f \circ g$ is one-to-one.    (b) Since $f$ is surjective we know that for all $c \in C$ there is a $b\in B$ such that $f(b)=c$.  Since $g$ is surjective, there is a $a \in A$ such that $g(a)=b$.  Hence, for all $c \in C$ there is an $a \in A$ such that $(f \circ g)(a)=f(g(a))=f(b)=c$.    (c)  This is false.  Let $A=\{1\}$, $B=\{1,2\}$, and $C=\{1\}$. Define $g(1)=1$ and $f(1)=f(2)=1$. Then $f \circ g$ is injective, but $f$ is not injective.    (d)  This is true.  Let $a,b \in A$ where $a \neq b$.  If $(f\circ g)(a)\neq(f\circ g)(b)$, then $f(g(a))\neq f(g(b))$.  Hence $g(a) \neq g(b)$.  (e)  Since $f \circ g$ is surjective, then for every $ c \in C$ there is an $a \in A$ such that $f(g(a))=c$.   Let $b = g(a)$.  Then $b \in B$ and $f(b)=g(f(a))=c$.  Thus $f(b)=c$.  Hence $f$ is surjective.  (f)  Using the same set up as part (c), we have that $g$ is not surjective since there is nothing in $A$ such that $g$ will go to 1. How do I run an executable using Lua? When functions commute under composition NSString by removing the initial zeros?