translated fortran to javascript