How could the following be?  require "bigdecimal/util"  86.26.to_d == 86.26 # =&gt; false 86.25.to_d == 86.25 # =&gt; true
27
Consider the following code:   0.1 + 0.2 == 0.3  -&gt;  false   0.1 + 0.2         -&gt;  0.30000000000000004   Why do these inaccuracies happen?
2201
I want a to be rounded to 13.95.  &gt;&gt;&gt; a 13.949999999999999 &gt;&gt;&gt; round(a, 2) 13.949999999999999   The  function does not work the way I expected.
115153
I know you can't rely on equality between double or decimal type values normally, but I'm wondering if 0 is a special case.  While I can understand imprecisions between 0.00000000000001 and 0.00000000000002, 0 itself seems pretty hard to mess up since it's just nothing.  If you're imprecise on nothing, it's not nothing anymore.  But I don't know much about this topic so it's not for me to say.  double x = 0.0; return (x == 0.0) ? true : false;   Will that always return true?
64085
After browsing through related threads, I am now of the understanding (please correct me if I am wrong) that the rule of thumb is to use the \bigl,\bigr pair with brackets, parentheses, etc. for operators like sums, products, and integrals, and \left,\right in all other cases.  I only recently found out about \middle , which has solved what had been a vexing problem for me: delimiters for function arguments (slashes, bars) not scaling properly. Leafing through my cheatsheet has not been of much help, so I wish to ask: is there an equivalent of \middle for \bigl and \bigr, or would the use of \middle along with that pair not be gauche?
28516
How do I format a number in Java? What are the &quot;Best Practices&quot;? Will I need to round a number before I format it?  32.302342342342343 =&gt; 32.30 .7323 =&gt; 0.73  etc.
113808
I'm writing 'cause I would like to know if there's an automatic way (like something to put in the preamble) to make the subscript behave as double subscript: for example if I write   something_a    it should behave as   something_{_a}
9683
Hey all I asked this over  =) and I got a good answer but I still have no idea whats going on. I want to know how the expression got to the answer and maybe the math behind how it was reasoned.. the steps if you would be so kind. The likelihood is I don't understand the equation.   I'm not a big maths person please be gentle :p     For all those playing along at home I'm reading Absolute Java 5th   Edition by Walter Savitch (Chapter 2 Page 66).      The Expression  double d = 12345.123456789; System.out.printf("START%12.5e END %n", d);       The Answer  START 1.23451e+04END       I understand the basic principles of this printf method's arguments   for example I know the '%' represents the start of the parameters.   '12' is the number of spacing, '.5' is the times the decimal point   will move.... I see the decimal point has moved 4 places towards the   left... can someone explain the principles of e-notation. Also how   this expression came to this answer =).      As far as e-notation go's its meant to be scientific notation;      So like 5.89e-4 would mean 0.000589 (move the decimal place if minus   left if not move the decimal place right).
2846
Why does the following behave unexpectedly in Python?  &gt;&gt;&gt; a = 256 &gt;&gt;&gt; b = 256 &gt;&gt;&gt; a is b True           # This is an expected result &gt;&gt;&gt; a = 257 &gt;&gt;&gt; b = 257 &gt;&gt;&gt; a is b False          # What happened here? Why is this False? &gt;&gt;&gt; 257 is 257 True           # Yet the literal numbers compare properly   I am using Python 2.5.2. Trying some different versions of Python, it appears that Python 2.3.3 shows the above behaviour between 99 and 100.  Based on the above, I can hypothesize that Python is internally implemented such that "small" integers are stored in a different way than larger integers and the is operator can tell the difference. Why the leaky abstraction? What is a better way of comparing two arbitrary objects to see whether they are the same when I don't know in advance whether they are numbers or not?
7653
public class doublePrecision {     public static void main(String[] args) {          double total = 0;         total += 5.6;         total += 5.8;         System.out.println(total);     } }   The above code prints:  11.399999999999   How would I get this to just print (or be able to use it as) 11.4?
104222
I'm trying to have a small function that I then call.  To keep it simple I just want to validate that 12 is divisible by 2,3 and 4  The code is:  divisible_by () {   under_test=12   from=2   to=4   divisible=0   for ((check=from; check&lt;=to; check++)) {     echo "check= $check"     if [ $under_test % $check -ne 0 ]; then       divisible=1     fi     }   return $divisible }  x=divisible_by if [ $x -eq 0 ]; then   echo "true" else   echo "false" fi   Currently I get   ./5_divisible_by_1_to_10.sh: line 16: [:  divisible_by: integer expression expected false   I'm also finding it hard to pass the number in as a parameter but maybe it's related.
48818
I'm using siunitx to input some big numbers and units in my document.  Is there a way to make the output of \num{3.14} be "3,13" instead of "3.13"? In Spanish, we use the first one.
22201
I am getting an Error: Bad math evironment delimiter for the following lines:`  \[ \sum\limits_{i=1}^{10} i z_{i}\equiv 0\)\ \textrm{mod}\ 11 \]   and  \[ z_{1} \equiv -  \(\sum \limits_{i=2}^{10} i z_{i}\)\ \textrm{mod}\ 11 0\leq z_{1}\leq 10  \]   The output is shown correctly
51816
Is the behavior of .* to include . and .. defined in LSB or POSIX or some other specification?
113604
I was messing around with my TI-84 Plus Silver Edition calculator and discovered that it will actually give me values when taking the factorial of any number $n/2$ where $n$ is any integer greater than $-2$. Why does this happen? I thought factorials were only defined for positive integers and $0$, so what is my calculator doing to get the answer $3.32335097$ when I enter $2.5!$? Is there actually a definition of $2.5!$ or is my calculator just being weird? How is the factorial function implemented?  I understand the binary implications of $2.5$, so that could possibly have something to do with it. I get a domain error when trying to take the factorial of $-1, 2.3, e$, and any number that is not of the form $n/2$ where $n$ is any integer greater than $-2$.
96922
Why when I save a value of say 40.54 in SQL Server to a column of type Real does it return to me a value that is more like 40.53999878999 instead of 40.54?  I've seen this a few times but have never figured out quite why it happens.  Has anyone else experienced this issue and if so causes it?
112920
How can I round a decimal number (floating point) to the nearest integer?   e.g.  1.2 = 1 1.7 = 2
118714
When dealing with double data types is multiplying by the inverse better or worse? Which way is faster? Which way uses less memory? Which way is preferred? How does MSIL handle this? SquareInches = MMSquared / 645.16  SquareInches = MMSquared * 0.0015500031000062000124000248000496    NB: 10K users will note that this is a duplicate of , which was deleted because the original question asker decided to berate everyone in the 'comments' section of the question.  This question was reposted because it is a 'good' question. Please 'uncheck' Community Wiki for your answer, as I'm only posting this as CW so that it's not seen as a 'reputation' grab. Related Question: