News for hackers. Stuff that matters.
Re:Can we trust floating-point numbers? (2006) [pdf] by michaelochurch on Tuesday September 16, 2014 @11:36AM (#8324994)
BLAS doesn't use floating-point numbers? So what does it use? My impression was that BLAS was a library of fast linear algebra. Decimals are not fast, as far as I'm aware.
Re:Can we trust floating-point numbers? (2006) [pdf] by minimax on Tuesday September 16, 2014 @11:52AM (#8325102)
It does use floating point. I think the slide was misleading.

http://www.netlib.org/blas/blast-forum/cblas.h

Re:Can we trust floating-point numbers? (2006) [pdf] by acqq on Tuesday September 16, 2014 @12:37PM (#8325383)
BLAS uses it, and Excel of course also uses floating point.

On the first look, it appears a dubious presentation anyway. The examples don't have much sense too: you can't actually calculate properly sin( 10e22 ) in binary floating point format because both exponent and mantissa are binary: the exponent is 2^76 and in 4-bytes floats you have 23 bits, in 8-byte doubles 53 bits, so you can't even represent the starting number with the enough bits to calculate meaningful sin. You'd need a two parameter function to be even able to pass what you actually want to pass. So calling sin( 10e22 ) in the languages with 4 or 8-bytes binary FP of course can't be expected to produce any meaningful result.

But maybe all this was spoken, not written, and it's just misleading to read it without knowing the comments.

"Who is NOT using: Excel, BLAS" could maybe then mean that author wanted to say "Excel, BLAS, they use them too"? (If we want to believe that he had any idea what he wrote about). Definitely not good to give this presentation to somebody who doesn't already know more. Confusion guaranteed.

Re:Can we trust floating-point numbers? (2006) [pdf] by stephencanon on Tuesday September 16, 2014 @02:39PM (#8326183)
Paul Zimmermann certainly knows that BLAS and Excel use floating-point. I assume that the spoken content of the presentation made the meaning of those slides much clearer; it’s too bad that the slides are being discussed in a vacuum.

Also 1e22 (note: not 10e22) is exactly representable in double (though not in float). Specifically, it is exactly equal to:

    1.000011110000110011110000011001001101110101011001001 * 2^73
which requires only a 52 bit significand.
Re:Can we trust floating-point numbers? (2006) [pdf] by acqq on Tuesday September 16, 2014 @04:44PM (#8327001)
You are absolutely right, 1e22 fits in the double, exactly with the bit pattern you showed. And it doesn't fit in the float. Thanks. One more proof that PDF alone is too little of the presentation and that it's easy for the reader to remain confused. I consider your reply "a missing slide" between p 15 and p 16.

So the author is: http://en.wikipedia.org/wiki/Paul_Zimmermann

Re:Can we trust floating-point numbers? (2006) [pdf] by Aardwolf on Tuesday September 16, 2014 @11:49AM (#8325077)
I think it does use them? What does "real" here mean? http://www.netlib.org/lapack/explore-html/d8/daf/saxpy_8f.ht...

Seems to mean floating point according to this...: http://www-classes.usc.edu/engr/ce/108/text/fbk01.htm

Please correct me if I'm wrong, I'm not that familiar with Fortran.

Re:Can we trust floating-point numbers? (2006) [pdf] by sharpneli on Tuesday September 16, 2014 @12:04PM (#8325181)
It does use floats.

Floats are not that much of a problem as people might think. They come as a surprise for those that don't know how they work. Small course in numerical analysis would do people good.

Switching to fixed point would not cure anything, just change the ways they can break. Floats actually have way superior error propagation properties compared to fixed point if your range varies widely, as it often does in physics. In a massively simplified way one can say that multiplication is error free in floats whereas in fixed point multiplication is horrible.

Re:Can we trust floating-point numbers? (2006) [pdf] by dragonwriter on Tuesday September 16, 2014 @12:48PM (#8325438)
Switching to arbitrary position decimal/rational would cure most easily curable problems (which are the ones that deal with simple arithmetic not working as expected.)

Dealing with the bigger problems (like combining arithmetic with transcendental functions and then getting bitten by approximation issues) require using a symbolic math engine and only reducing to numeric approximations when needed (e.g., for presentation) rather than for intermediate values.

"Throw floats at the problem and hope that it works okay" is a great approach for performance, but not really the best approach for correctness. Which is fine, if its a conscious decision, but its so pervasive and encouraged by most programming environments that its easy for people to forget the tradeoff that they are making.

Re:Can we trust floating-point numbers? (2006) [pdf] by silentvoice on Tuesday September 16, 2014 @11:56AM (#8325126)
It's a little bit of a misrepresentation on the part of the presenter. BLAS is a specification for linear algebra software, of which implementers are free to use the most appropriate representation of numbers as they wish - the fastest being floating point because of native hardware support.

Although the naming schemes for BLAS routines do explicitly reference "single precision" and "double precision" so now I'm confused too.