Hi
I am trying to translate Fortran to C++, and I encountered a Fortran line I can't understand:
DOUBLE PRECISION FUNCTION ROUNDN (NUMBER,DEC)
DOUBLE PRECISION ARG,FACT,NUMBER,ROUND
ARG = DABS (NUMBER)
IF(DEC-1.) 1,2,2
1 <calculations on label 1>
2 <calculations on label 2 >
My problem is the IF statement. Obviously it goes to label 1 or 2 depending on the outcome of DEC-1. But how does it work? What is the logic?
It is a rounding function. I don't want to paste in the very code since it is not mine.
For example, if NUMBER is 39.99 and DEC 1.0, it goes to 2.
Thankful for any help
Perry
I am trying to translate Fortran to C++, and I encountered a Fortran line I can't understand:
DOUBLE PRECISION FUNCTION ROUNDN (NUMBER,DEC)
DOUBLE PRECISION ARG,FACT,NUMBER,ROUND
ARG = DABS (NUMBER)
IF(DEC-1.) 1,2,2
1 <calculations on label 1>
2 <calculations on label 2 >
My problem is the IF statement. Obviously it goes to label 1 or 2 depending on the outcome of DEC-1. But how does it work? What is the logic?
It is a rounding function. I don't want to paste in the very code since it is not mine.
For example, if NUMBER is 39.99 and DEC 1.0, it goes to 2.
Thankful for any help
Perry