!     Last change:  A     7 Nov 2004    9:37 pm
PROGRAM superman1
!-----------------------------------------------------------------------------
!                                                           Date:
! Names:
!
! Program to calculate the input into the second program
!
! Variables use are:
!
! Input  :
! Output :
!-----------------------------------------------------------------------------
IMPLICIT NONE

REAL (KIND=8) :: x, left, right, chopper !left = a, right = b
INTEGER :: temp

WRITE(*,*) "Enter a root x, the root on the left, and the root on the right: "
READ(*,*) x, left, right

!!! rounds each variable to 4 places after the decimol
temp = x*10000.0D0
chopper = x - REAL(temp)/10000.0D0
x = x - chopper

temp = left*10000.0D0
chopper = left - REAL(temp)/10000.0D0
left = left - chopper

temp = right*10000.0D0
chopper = right - REAL(temp)/10000.0D0
right = right - chopper
!!! rounds

left = x - left
right = right - x
IF (ABS(left) < ABS(right)) THEN
   right = 0.3D0 * left                        !right = b
   left  = 0.1D0 * left                        !left = a
ELSE
   left   = 0.1D0 * right                      !left = a
   right  = 0.3D0 * right                      !right = b
END IF

left = x - left
right = x + right
WRITE(*,*) "x-a: ", left
WRITE(*,*) "y-b: ", right

STOP
END PROGRAM superman1
