I`m converting subroutine from fortran code into the excel. But I faced a problem, that these loops, which are working correctly under fortran, are not working "correctly" under vba. Lost all day trying to figure out problem without success.
[b]What loops?[/b] I didn't see any DO loops inside the subroutine. Just a lot of IF-THEN-ELSE- ENDIF statements. You might want to indent inside the IF statements to see if there is something missing and the FORTRAN compiler is compensating.
Please, dont focus on that loop, I didn`t add a loop in attachment, just subroutine. The thing is that this subroutine is inside the loop. abstractly it should look like
In the same if-then-else system i have a different results running it under fortran and under VBA. E.g. If I`m processing input_data file with 2250 records, the summoned parameters, like "sumBy" here, it differ about 0,5% of it`s value. In fortran it`s 1085, in VBA - 1045.
If someone wants to play around with this and prove me wrong, I`m adding full code in attachment.
Comments
the subroutine. Just a lot of IF-THEN-ELSE-
ENDIF statements. You might want to indent
inside the IF statements to see if there is
something missing and the FORTRAN compiler is
compensating.
[code]
do until eof(sample_data)
get_step_parameters(sample_data)
call mysubroutine(parameters,form,sample,data,and,many,many2,more,parameters,which,are,calculated,from,previous,loop,by,reference)
debug.print which,are
many=0
many2=0
more=0
sumBy=sumBy+by
loop
[/code]
In the same if-then-else system i have a different results running it under fortran and under VBA. E.g. If I`m processing input_data file with 2250 records, the summoned parameters, like "sumBy" here, it differ about 0,5% of it`s value. In fortran it`s 1085, in VBA - 1045.
If someone wants to play around with this and prove me wrong, I`m adding full code in attachment.
before calling sub "snow" there were variable with default value all the time.