float equality

Walter Bright newshound2 at digitalmars.com
Sun Feb 20 12:32:03 PST 2011


Jonathan M Davis wrote:
> There's way too much to worry about. I don't _want_ to have to be worrying about 
> rounding error and that sort of thing. I generally want to do whatever 
> calculations I need to do for a particular task and be done with it. Math 
> doesn't interest me enough for me to want to deal with it more than I have to to 
> solve a particular problem. I find the fact that you have to worry about losing 
> precision with floating point values and that they can't even represent all of 
> the values in their range horrific. It's a fact of life, and you have to deal 
> with it, but it sure isn't pretty.

But that's true of any calculation you do, once you get past symbolic math.

It's like if you're cutting wood and do not take into account the width of the 
saw blade. The parts won't fit together right.

I was once on a hot rod forum where a guy was making a mold in order to cast his 
own intake manifold. I suggested to him that he had to make the mold larger than 
the actual part, in order to account for the shrinkage of hot aluminum down to 
room temperature. I calculated by about 1/2 inch. He thought I was an idiot, and 
ignored me. His manifold came out too small by half an inch.


More information about the Digitalmars-d mailing list