in reply to Re: Floating Point Errors
in thread Floating Point Errors

well I need to use floating integers because my precision should be at about 0.01. The project is about molecular modelling so I am using perl:pdl and there are many times I need to take inverses of operators. It is highly unlikely that I can avoid floating integers :/ I was just right now reading the article you gave though, thanks.

Replies are listed 'Best First'.
Re^3: Floating Point Errors
by starbolin (Hermit) on May 28, 2008 at 00:11 UTC

    I think what kyle was trying to say is that you will always have errors with floating-point. The only way to avoid them is to rescale all your operations to used fixed- point math. It can be done. Before system designers had math co-processor chips and Pentium uber-chips many analog systems were designed using fixed point math.


    s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}
Re^3: Floating Point Errors
by kyle (Abbot) on May 28, 2008 at 15:45 UTC

    starbolin is correct. I struggled through a whole semester about nothing but floating point problems, and almost the only thing I took away from it was, "don't use floating point numbers."

    There are an infinite number of real numbers between 0 and 1, but only a finite number of them can be represented the way floats are normally stored. Out between 100 and 101, there is the same infinity of real numbers, but even fewer of them can be represented.

    Looking at the number line through the filter of a float is a sea of emptiness and disappointment, I tell you!