Fortran 90 数値関数
y = aimag(z)
complex,intent(in) :: z
real :: y = Im(z)
aint, anint
aint :
小数点以下を切り捨てる (ie int)
anint:
小数点以下を四捨五入する (ie nint)
y = aint(a [,kind])
real,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
real(kind=kind) :: y ! a-1 < y <= a
i = anint(a [,kind])
real,intetn(in) :: a
integer,intent(in) :: kind ! default is same of a
real(kind=kind) :: y ! a - 0.5 < y <= a + 0.5
ceiling, floor
ceiling:
引数以上で最小の整数を求める
floor :
引数以下で最大の整数を求める
i = ceiling(a)
real,intent(in) :: a
integer :: i ! a <= i < a+1
i = floor(a)
real,intent(in) :: a
integer :: i ! a-1 < i <= a
cmplx
複素数に変換する
z = cmplx(x [,y] [,kind])
integer,intent(in) :: x
integer,intent(in) :: y
integer,intent(in) :: kind ! default is same of x
complex(kind=kind) :: z = x + iy
integer,intent(in) :: x
real,intent(in) :: y
integer,intent(in) :: kind ! default is same of x
complex(kind=kind) :: z = x + iy
real,intent(in) :: x
integer,intent(in) :: y
integer,intent(in) :: kind ! default is same of x
complex(kind=kind) :: z = x + iy
real,intent(in) :: x
real,intent(in) :: y
integer,intent(in) :: kind ! default is same of x
complex(kind=kind) :: z = x + iy
complex,intent(in) :: x
integer,intent(in) :: kind ! default is same of x
complex(kind=kind) :: z = x
conjg
共役複素数を求める
y = conjg(z)
complex,intent(in) :: z
complex :: y = Re(z)-iIm(z)
dble
倍精度実数型に変換する
d = dble(a)
real,intent(in) :: a
real(kind=8) :: d
dim
第一引数が第二引数よりもどれだけ大きいかを求める
z = dim(x,y)
integer,intent(in) :: x, y
integer :: z = x-y (x > y)
= 0 (x < y)
real,intent(in) :: x, y
real :: z = x-y (x > y)
= 0 (x < y)
dprod
倍精度実数型の積を計算する
z = dprod(x,y)
real(kind=4),intent(in) :: x, y
reak(kind=8) :: z = dble(x)*dble(y)
kind
種別型パラメタ値を返す
i = kind(x)
integer,intent(in) :: x
real,intent(in) :: x
complex,intent(in) :: x
integer :: i
int, nint
int :
小数点以下を切り捨てた整数を求める (ie aint)
nint:
小数点以下を四捨五入した整数を求める (ie aint)
i = int(a [,kind])
integer,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
inteter(kind=kind) :: i = a
real,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
integer(kind=kind) :: i ! a-1 < i <= a
complex,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
integer(kind=kind) :: i = int(real(a))
i = nint(a [,kind])
real,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
integer(kind=kind) :: i = int(anint(a))
complex,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
integer(kind=kind) :: i = int(anint(real(a)))
max, min
max:
引数の中で最大値を求める
min:
引数の中で最小値を求める
y = max(a1, a2 [,a3] [,a4] [,…])
integer,intent(in) :: a1, a2, a3, a4, …
integer :: y ! y >= a1, a2, a3, a4, …
real,intent(in) :: a1, a2, a3, a4, …
real :: y ! y >= a1, a2, a3, a4, …
y = min(a1, a2 [,a3] [,a4] [,…])
integer,intent(in) :: a1, a2, a3, a4, …
integer :: y ! y <= a1, a2, a3, a4, …
real,intent(in) :: a1, a2, a3, a4, …
real :: y ! y <= a1, a2, a3, a4, …
real
実数型に変換する
y = real(a [,kind])
integer,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
real(kind=kind) :: y = 1.0*a
real,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
real(kind=kind) :: y = a
complex,intent(in) :: a
integer,intent(in) :: kind ! default is same of a
real(kind=kind) :: y = Re(a)
selected_int_kind,selected_real_kind
selected_int_kind : 有効桁数p以上で精度が最小である種別パラメタを返す
selected_real_kind: 有効桁数p、指数範囲r以上で精度が最小である種別パラメタを返す
kind = selected_int_kind(r)
integer,intent(in) :: r
integer :: kind
kind = selected_real_kind([p] [,r])
integer,intent(in) :: p, r ! 少なくとも1つの引数は指定しなければならない
integer :: kind
sign
第一引数の絶対値に第二引数の符合をつけたものを求める
z = sign(a, b)
integer,intent(in) :: a, b
integer :: z = abs(a) * b / abs(b)
real,intent(in) :: a, b
real :: z = abs(a) * b / abs(b)
transfer
sourceと物理表現が同じであるmoldと同じ型の値を返す
z = transfer(source, mold [,size])
*,intent(in) :: source or source(:)
*,intent(in) :: mold or mold(:)
integer,intent(in) :: size
* :: z or z(size) ! type is same of mold
back