Steven Schveighoffer <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #5 from Steven Schveighoffer <> 2010-01-29 
05:44:47 PST ---
(In reply to comment #4)
> I'm not certain that there's a bug here (difficult to tell without reducing 
> the
> test case further). It could be that in the optimised case you have a 
> temporary
> value stored in a register, increasing the precision. It's legal for the
> compiler to do that. Adding a function call stops DMD from keeping the value 
> in
> a register.
> Anyway you need to cut the test case down significantly.
> BTW it behaves the same way on DMD0.175, so this is definitely not a
> regression.

I think this is exactly the problem.  You are using floating point expecting
that all floats are created equal.

One rule about floating point is never to build an infinite loop waiting for
two floats to converge using ==.  You must use an epsilon if you expect any
reasonable result.

Your exit condition is this:

if (left == half || right == half)

What about trying this:

if(half - left < SOME_EPSILON || right - half < SOME_EPSILON)

where SOME_EPSILON is a very small insignificant number, like 0.000001

floating point convergence is an art form, you need to understand its

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to