Clicky
Showing changes from revision #2 to #3:
(追記) Added (追記ここまで) | (削除) Removed (削除ここまで) | (削除) Chan (削除ここまで)(追記) ged (追記ここまで)
return the kind value of a real data type with decimal precision(削除) selected_real_kind(p,r) (削除ここまで)(追記) selected_real_kind(p, (追記ここまで)(追記) r, (追記ここまで)(追記) radix) (追記ここまで)(削除) greater (削除ここまで) of at leastp (削除) digits (削除ここまで)(追記) digits, (追記ここまで)(削除) and (削除ここまで) exponent range(削除) greater (削除ここまで)(追記) of (追記ここまで) at leastr(追記) , and with a radix of (追記ここまで)(追記) radix (追記ここまで).
Fortran 95 (追記) and later; with (追記ここまで)(追記) radix (追記ここまで)(追記) (追記ここまで)(追記) Fortran 2008 (追記ここまで) and later
Transformational function
result = selected_real_kind(p, r)
result = selected_real_kind([p, r, radix]) (追記ここまで)
p - (Optional) shall be a scalar and of type integer.r - (Optional) shall be a scalar and of type integer.radix - (Optional) shall be a scalar and of type integer.(削除) At (削除ここまで)(追記) Before (追記ここまで)(削除) least (削除ここまで)(削除) one (削除ここまで)(削除) argument (削除ここまで)(削除) shall (削除ここまで)(削除) be (削除ここまで)(削除) present. (削除ここまで)(追記) Fortran 2008 (追記ここまで)(追記) , at least one of the arguments (追記ここまで)(追記) r (追記ここまで)(追記) or (追記ここまで)(追記) p (追記ここまで)(追記) shall be present; since (追記ここまで)(追記) Fortran 2008 (追記ここまで)(追記) , they are assumed to be zero if absent. (追記ここまで)
selected_real_kind returns the value of the kind type parameter of a real data type with decimal precision of at least p (削除) digits (削除ここまで)(追記) digits, (追記ここまで)(削除) and (削除ここまで) a decimal exponent range of at leastr(削除) . (削除ここまで)(追記) , (追記ここまで)(削除) If (削除ここまで)(追記) and (追記ここまで)(削除) more (削除ここまで)(削除) than (削除ここまで)(削除) one (削除ここまで)(削除) real (削除ここまで)(削除) data (削除ここまで)(削除) type (削除ここまで)(削除) meet (削除ここまで)(削除) the (削除ここまで)(削除) criteria, (削除ここまで)(削除) the (削除ここまで)(削除) kind (削除ここまで)(削除) of (削除ここまで)(削除) the (削除ここまで)(削除) data (削除ここまで)(削除) type (削除ここまで) with the(削除) smallest (削除ここまで)(追記) requested (追記ここまで)(削除) decimal (削除ここまで)(削除) precision (削除ここまで)(削除) is (削除ここまで)(削除) returned. (削除ここまで)(削除) If (削除ここまで)(削除) no (削除ここまで)(削除) real (削除ここまで)(削除) data (削除ここまで)(削除) type (削除ここまで)(削除) matches (削除ここまで)(削除) the (削除ここまで)(削除) criteria, (削除ここまで)(削除) the (削除ここまで)(削除) result (削除ここまで)(削除) is (削除ここまで)(追記) radix (追記ここまで)(追記) . If the (追記ここまで)(追記) radix (追記ここまで)(追記) parameter is absent, real kinds with any radix can be returned. If more than one real data type meet the criteria, the kind of the data type with the smallest decimal precision is returned. If no real data type matches the criteria, the result is (追記ここまで)
p(追記) , but the (追記ここまで)(追記) r (追記ここまで)(追記) and (追記ここまで)(追記) radix (追記ここまで)(追記) requirements can be fulfilled (追記ここまで)r(追記) , but (追記ここまで)(追記) p (追記ここまで)(追記) and (追記ここまで)(追記) radix (追記ここまで)(追記) are fulfillable (追記ここまで)radix (追記ここまで)(追記) but not (追記ここまで)(追記) p (追記ここまで)(追記) and (追記ここまで)(追記) r (追記ここまで)(追記) requirements are fulfillable (追記ここまで)radix and either p or r requirements are fulfillableradixprogram real_kinds
integer,parameter :: p6 = selected_real_kind(6)
integer,parameter :: p10r100 = selected_real_kind(10,100)
integer,parameter :: r400 = selected_real_kind(r=400)
real(kind=p6) :: x
real(kind=p10r100) :: y
real(kind=r400) :: z
print *, precision(x), range(x)
print *, precision(y), range(y)
print *, precision(z), range(z)
end program real_kinds(追記)
(追記ここまで)(追記)