Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: