Onno Garms <[EMAIL PROTECTED]> writes:

>   while (1)
>   {
>     c = a/b;
>     if (a/b<=c) break;
>   }
> }
>
> Can anybody explain why this hangs?

C and C++ allow a compiler to compute floating point expressions with
greater precision than apparent in the type, unless the value is
stored in a variable or explicitly cast.

> - if (static_cast<double>(a/b)<=c)
>   endless loop

This looks like a bug in the compiler, a cast should cut off excess
precision.

gcc has an option to turn this off: -ffloat-store

--
   __("<         Marcin Kowalczyk
   \__/       [EMAIL PROTECTED]
    ^^     http://qrnik.knm.org.pl/~qrczak/

_______________________________________________
Help-gplusplus mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to