Magic infinite loop inside foreach

MrSmith mrsmith33 at yandex.ru
Fri Jan 31 06:05:08 PST 2014


On Thursday, 30 January 2014 at 23:45:14 UTC, Joseph Rushton 
Wakeling wrote:
> On 31/01/14 00:08, MrSmith wrote:
>> Somehow if i comment out
>> //matrix = solveTemp(temp);
>> it works, but this method works fine, and after it done1 is 
>> printed. Strange.
>
> That does rather suggest that it's that method that is causing 
> things to get stuck.  Can you share what's inside it?  And when 
> you say "this method works fine", do you mean that you've 
> manually tested it with the temp variable that goes in before 
> it hangs?
>
> Could it be that whatever printout you're doing of variables 
> like matrix is missing some tiny differences -- floating-point 
> rounding errors? -- that are responsible for the 
> transformations inside makeTemp or solveTemp behaving wrongly 
> and therefore (in the latter case) getting stuck?

Here is complete code (excluding rational.d by DSimcha) 
https://gist.github.com/MrSmith33/8732520

It prints:

foreach start
after makeTemp
solveTemp start
before solveTemp return
foreach end

and then stucks.
As you can see it goes through solveTemp method and stops at the 
foreach end.
So, i can not see any reason why it goes infinite there.


More information about the Digitalmars-d-learn mailing list