<Example Program>
Program set_exponent_example Implicit None Real :: x(3) = [ 1.375*2.0**(-100), 1.375, 1.375*2.0**100 ] Print 1, 'x', x 1 Format(1X,A20,1X,3ES12.4) Print 1, 'scale formula(0)', Scale(x,0-Exponent(x)) Print 1, 'fraction form(0)', Fraction(x) Print 1, 'set exponent (0)',Set_Exponent(x,0) Print 1, 'set exponent (1)',Set_Exponent(x,1) End Program
Execution Results
x 1.0847E-30 1.3750E+00 1.7430E+30 scale formula(0) 6.8750E-01 6.8750E-01 6.8750E-01 fraction form(0) 6.8750E-01 6.8750E-01 6.8750E-01 set exponent (0) 6.8750E-01 6.8750E-01 6.8750E-01 set exponent (1) 1.3750E+00 1.3750E+00 1.3750E+00