Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-13 Thread jung . felix
Thanks for all the replies. I considered working with BigFloats and other data types. However, after reading this article by John Cook , I got the idea that the main problem I'm having is the subtraction when c

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Brian Harris
Back in the day when we did a lot of fortran work, we had a compiler with a flag to make double precision variables become single precision or quad precision. There was also a flag "trapuv" to turn any undefined variable to NAN and cause a fault. These were extremely useful to understand the

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Tim Holy
It might help to look at an example; an easy, well-known one is the quadratic formula. The formula you learned in high school is not how you want to compute the solutions: http://people.csail.mit.edu/bkph/articles/Quadratics.pdf Evaluation of special functions provides a nearly-endless supply of

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Stefan Karpinski
BigFloats can certainly help – but they are still finite precision, so you still have these issues, just to a lesser extent. You may also want to try DoubleDouble , which will be more precise than Float64 but much faster than using BigFloats. Your Jul

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Andreas Noack
It is difficult to conclude anything when we only see part of your problem, but from what you write, I wouldn't say the noise in summation s1 + s2 + s3 + s4 + s5 is the problem. With floating points, it is unavoidable to get small (or larger) errors with addition and subtraction. I'd rather say tha

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Pablo Zubieta
In your case you may want to try with arbitrary precision floats (BigFloat) So just define x = BigFloat[1, 0.045126, 6.9315] w1 = w2 = w3 = BigFloat[1 1 1] w4 = BigFloat[1 -10 -10] and call your function as compute(f1[1], f2[1], f3[1], d[1], BigFloat(0), BigFloat(153))

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Tamas Papp
On Thu, Feb 12 2015, jung.fe...@gmail.com wrote: > Hi, > > I've run into a problem that I hadn't even considered so far. When > computing the analytical solution to a positive integral (its an > integral over a quadratic function) I got extremely negative values > from Julia. Here is some example

Re: [julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread Tom Short
This section in the manual might help: http://julia.readthedocs.org/en/latest/manual/integers-and-floating-point-numbers/#background-and-references On Thu, Feb 12, 2015 at 3:48 AM, wrote: > Hi, > > I've run into a problem that I hadn't even considered so far. When > computing the analytical sol

[julia-users] Numerical precision of simple mathematical operations

2015-02-12 Thread jung . felix
Hi, I've run into a problem that I hadn't even considered so far. When computing the analytical solution to a positive integral (its an integral over a quadratic function) I got extremely negative values from Julia. Here is some example code: function compute(f1, f2, f3, d, l, u) ## Some a