real(4) function ULP_4(x)
real(4) x

!P =24; Emin =-126;
if(x /=0.) then
ULP_4 =2.0**(exponent(x) -24)
else
ULP_4 =2.0**(-149)   ! Emin-P+1; ~ nearest(0.,+)
endif
end function ULP_4

real(8) function ULP_8(x)
real(8) x

!P =53; Emin =-1022;
if(x /=0.d0) then
ULP_8 =2.D0**(exponent(x) -53)
else
ULP_8 =2d0**(-1074)
endif
end function

real(16) function ULP_16(x)
real(16) x
!P =113; Emin =-16382;

if(x /=0.q0) then
ULP_16 =2.Q0**(exponent(x) -113)
else
ULP_16 =2q0**(-16494)
endif

end function
