
      SUBROUTINE ADDLN2(ALN,BLN,CLN,ISGN)
C Copyright, Bernd Berg, Oct 7, 2000.
C Given ln(A) and ln(B), A>0,B>0. Output for
C ISGN=+1: CLN=ln(C) with C=A+B, ISGN unchanged,
C ISGN=-1: CLN=ln(C) with C=|A-B|, ISGN=+1 for A>B and ISGN=-1 for A<B.
      include 'implicit.sta'
      include 'constants.par'
      AALN=MAX(ALN,BLN)
      BBLN=MIN(ALN,BLN)
      IF(ISGN.EQ.1) THEN
        CLN=AALN+LOG(ONE+EXP(BBLN-AALN))
      ELSE
        IF(ALN.GT.BLN) ISGN=+1 
        CLN=AALN+LOG(ONE-EXP(BBLN-AALN))
      END IF
      RETURN
      END


