I just have a problem with a sum in php. My data are :  $t = array('-100.80', '-0.01', '-7.99', '-108.00', '-10.80', '-34.90', '-10.80', '-18.80', '-17.80', '-19.50', '-33.60', '-32.10', '-27.50', '-40.30', '-31.20', '-10.60', '-27.50', '-120.00', '-130.00', '100.80', '0.01', '7.99', '108.00', '10.80', '34.90', '10.80', '18.80', '17.80', '19.50', '33.60', '32.10', '27.50', '40.30', '31.20', '10.60', '27.50', '120.00', '130.00');   Total is normally 0 but if i execute an array_sum i just have :     -5.6843418860808E-14   If i add manually with floatVal() i just have the same result.  Could you explain me why i don't have 0 in result ?  Thanks.  Regards,
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?
88682
$$ = \sum_{e \in A} w(e)    = \sum_{e \in A} w(e)+ \sum_{e \in \{(r,v)| v \in V(G)\}} w(e)     = w( \~{A} ) $$   I get the following error message:     Error: Please use \mathaccent for accents in math mode for the following code   I'm not sure what's wrong with it. I'm in math mode by using $$  $$, am I not?
1748
I have a data like this:  input.txt  1 0000100101000000 1 0000010100000000 2 1110000001000000 2 1111000000001000 3 0000000111111111 3 1111111100000000 4 8888345500000000 4 0000000000000000   and I want to sum up the values within eachtwo rows with the same row number: output:  output.txt  1 0000110201000000 2 2221000001001000 3 1111111211111111 4 8888345500000000   any suggestion please? my real dat had 8000 rows with 45000 digit in each line
58895
Been trying to this line to parse for a good 20mins, but all attempts have failed:  \beta = $-$0.84, t = $-$2.09, P = 0.04   Could anyone tell me why I'm getting a Missing $ inserted error here?
18919
I am typing to get a sale amount (by input) to be multiplied by a defined sales tax (0.08) and then have it print the total amount (sales tax times sale amount).  I run into this error. Anyone know what could be wrong or have any suggestions?   salesAmount = raw_input (["Insert sale amount here \n"]) ['Insert sale amount here \n']20.99 &gt;&gt;&gt; salesTax = 0.08 &gt;&gt;&gt; totalAmount = salesAmount * salesTax  Traceback (most recent call last):   File "&lt;pyshell#57&gt;", line 1, in &lt;module&gt;     totalAmount = salesAmount * salesTax TypeError: can't multiply sequence by non-int of type 'float'
43916
I have much more experience programming than I do with advanced mathematics, so perhaps this is just a comfort thing with me, but I often get frustrated when I try to follow mathematical notation. Specifically, I get frustrated trying to keep track of what each variable signifies.  As a programmer, this would be completely unacceptable no matter how many comments you added explaining it:  float A(float P, float r, float n, float t) {   return P * pow(1 + r / n, n * t); }   Yet a mathematician would have no problem with this:     $A = P\ \left(1+\dfrac{r}{n}\right)^{nt}$      where   $A$ = final amount   $P$ = principal amount (initial investment)   $r$ = annual nominal interest rate (as a decimal)   $n$ = number of times the interest is compounded per year   $t$ = number of years   So why don't I ever see the following?  $\text{final_amount} = \text{principal}\; \left(1+\dfrac{\text{interest_rate}}{\text{periods_per_yr}}\right)^{\text{periods_per_yr}\cdot\text{years}}$
109820
Can anyone help please? I need to know how to make the sum of value S(n) = 0+1+2+3+4...+(n-1)+n (example: 0+1+2+3 = 6 , 0+1+2+3+4+5+6+7 = 28 and so on) on Latex
6195
Using PHP, what's the fastest way to convert a string like this: "123" to an integer?  Why is that particular method the fastest? What happens if it gets unexpected input, such as "hello" or an array?
108590
Is there a way for standard deviation to ignore negative numbers? In other words, how can you make it so that 2 or 3 deviations do not extend into negative territory?   When looking at a set of only positive numbers, within one or two standard deviations, I end up with negative numbers. It's essentially impossible for a data point to be negative.  Am I doing something wrong?   Also, when using deviations from the mean, do you add or subtract the full deviation from the mean or divide by two and plus and minus that to get one deviation from mean   I'm sure this embarrassingly simple for this group but this is not my strong point!   Please let me know if I can clarify.  My recent experience with statistics is relatively limited.  Thanks!
38011
I am developing a PHP application in which I am in need to store values bigger than 1 million, but with the flexibility of having floating points. I know the traditional float and double. I am looking to store only up to two decimal points, and will only handle operations with numbers that have 2 decimals exclusively.  I have chosen my column type of double and unsigned, but whenever I store a row with a value bigger than one million, it gets truncated to 999999.99  Why is this? I am looking for the right datatype/solution. If you could point me in the right direction, I will appreciate it a lot!  Thank you for your time in advance!  Cheers.
16405
In LaTeX2e,how can I sum two values and assign them to other variable?  I want to compute something like:   var=\textwidth - 1cm    And if both were constants:   var=1+1
70051
How can I format Floats in Java so that the float component is displayed only if it's not zero? For example:   123.45 -> 123.45 99.0   -> 99 23.2   -> 23.2 45.0   -> 45   Edit: I forgot to mention - I'm still on Java 1.4 - sorry!
16373
How do I pass have a Javascript script request a PHP page and pass data to it? How do I then have the PHP script pass data back to the Javascript script?  client.js:  data = {tohex: 4919, sum: [1, 3, 5]}; // how would this script pass data to server.php and access the response?   server.php:  $tohex = ... ; // How would this be set to data.tohex? $sum = ...; // How would this be set to data.sum? // How would this be sent to client.js? array(base_convert($tohex, 16), array_sum($sum))
56109
I'm curious as to whether or not there is a real difference between the money datatype and something like decimal(19,4) (which is what money uses internally, I believe).  I'm aware that money is specific to SQL Server. I want to know if there is a compelling reason to choose one over the other; most SQL Server samples (e.g. the AdventureWorks database) use money and not decimal for things like price information.    Should I just continue to use the money datatype, or is there a benefit to using decimal instead? Money is fewer characters to type, but that's not a valid reason :)
70173
While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of  Name : Value Name2 : Value2   etc.  The peoblem is that the values can sometimes be floats (with different precision), integers, or even in the form 2.20011E+17. What I want to output are pure integers. I don't know a lot of JavaScript, though.  How would I go about writing a method that takes these sometimes-floats and makes them integers?
135
Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example:  int[] terms;  for(int runs = 0; runs &lt; 400; runs++) {     terms[] = runs; }   For those who have used PHP, here's what I'm trying to do in C#:  $arr = array(); for ($i = 0; $i &lt; 10; $i++) {     $arr[] = $i; }
33306
Hey! I was looking at this code at   I noticed that in some situations they used hex numbers, like in line 134:  for (j = 1; val &amp;&amp; j &lt;= 0x80; j &lt;&lt;= 1, q++)   Now why would they use the 0x80? I am not that good with hex but I found an online hex to decimal and it gave me 128 for 0x80.  Also before line 134, on line 114 they have this:  small_n = (n &amp; 0xffff0000) == 0;   The hex to decimal gave me 4294901760 for that hex number. So here in this line they are making a bit AND and comparing the result to 0??  Why not just use the number? Can anyone please explain and please do give examples of other situations.  Also I have seen large lines of code where it's just hex numbers and never really understood why :(