Re: Fortran Code to Pascal Code



williamdiazs wrote:
I need to write tthe following in Pascal :

While this compiles without any problems, I get errors with
this part of code :

IN FORTRAN
real eig(36,5,5,5), diff(36), scores(5)

col = 4
row = 1
do i=1,5
scores(i) = sum(eig(1:36,col,row,i)*diff)
end do


In PASCAL
col := 4
row := 1
for i:= 1 to 5 do
begin
tempsum := 0.0;
for j:=1 to 36 do
begin
tempsum := tempsum + eig[j,col,row,i]*diff[j];
end;
scores[i] := tempsum;

end;

The scores array get different values IN PASCAL with the same data
Where is the error?
Thanks

Are you accounting for the reversal of subscript order from Fortran to Pascal?
.



Relevant Pages

  • Re: "init.c: No such file or directory."
    ... Some Fortran compiles compile to the C language then compile/ ... I ran the program with a debugging option (gdb) and I got the ... There is absolutely no warranty for GDB. ...
    (comp.lang.fortran)
  • Re: Why arent you using Bigloo?
    ... >>binary choice, use Fortran, and those who would use Basic. ... > Rhizome/pi compiles scheme code to C code wich then must be linked to a ... Is 45k LOC lean for a Scheme implementation? ...
    (comp.lang.scheme)
  • Total n00b gets compiler error with FORMAT statement...
    ... I've been asked to compile a Fortran program called Promotif 3.0 on one of our machines over here and I've got a little problem with a gettting one of the files compiled. ... $ must be the last specifier in format string at ... Warning: Obsolete: PAUSE statement at ... The program compiles eitherway but is the A supposed to go first or the whitespace? ...
    (comp.lang.fortran)
  • Re: Total n00b gets compiler error with FORMAT statement...
    ... I've been asked to compile a Fortran program called Promotif 3.0 on one of our machines over here and I've got a little problem with a gettting one of the files compiled. ... $ must be the last specifier in format string at ... Warning: Obsolete: PAUSE statement at ... The program compiles eitherway but is the A supposed to go first or the whitespace? ...
    (comp.lang.fortran)
  • Re: Double precision random number generator in Fortran 77
    ... >> it compiles and runs under watcom ... It's not strange. ... >>> The Fortran 77 version doesn't compile. ... >>> having a block data statement. ...
    (sci.math.num-analysis)

Loading