foreng_math_misc Module

Miscellaneous Mathematic functions



Contents


Interfaces

public interface factorial

Compute

  • public recursive function factorial_int16(x) result(x_fact)

    Recursively compute the factorial of a 16-bit integer. The max value that can be passed is 7 If x is less than 0 or greater 7, the function will return 0

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int16), intent(in) :: x

    Return Value integer(kind=int16)

  • public recursive function factorial_int32(x) result(x_fact)

    Recursively compute the factorial of a 32-bit integer. The max value that can be passed is 16 If x is less than 0 or greater 16, the function will return 0

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int32), intent(in) :: x

    Return Value integer(kind=int32)

  • public recursive function factorial_int64(x) result(x_fact)

    Recursively compute the factorial of a 64-bit integer. The max value that can be passed is 20 If x is less than 0 or greater 20, the function will return 0

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int64), intent(in) :: x

    Return Value integer(kind=int64)

  • public recursive function factorial_int128(x) result(x_fact)

    Recursively compute the factorial of a 128-bit integer [supported on gfortran]. The max value that can be passed is 33 If x is less than 0 or greater 33, the function will return 0

    Arguments

    Type IntentOptional AttributesName
    integer(kind=int128), intent(in) :: x

    Return Value integer(kind=int128)

public interface nth_root

Compute

  • public function nth_root_r32(x_, n_) result(root_)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real32), intent(in) :: x_
    integer, intent(in) :: n_

    Return Value real(kind=real32)

  • public function nth_root_r64(x_, n_) result(root_)

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in) :: x_
    integer, intent(in) :: n_

    Return Value real(kind=real64)

public interface exp_series

Compute using a truncated taylor series

  • public function exp_series_r32(x) result(exp)

    Compute using a taylor series with 12 terms

    Arguments

    Type IntentOptional AttributesName
    real(kind=real32), intent(in) :: x

    Return Value real

  • public function exp_series_r64(x) result(exp)

    Calculate using a taylor series with 20 terms

    Arguments

    Type IntentOptional AttributesName
    real(kind=real64), intent(in) :: x

    Return Value real(kind=real64)


Functions

public recursive function factorial_int16(x) result(x_fact)

Recursively compute the factorial of a 16-bit integer. The max value that can be passed is 7 If x is less than 0 or greater 7, the function will return 0

Arguments

Type IntentOptional AttributesName
integer(kind=int16), intent(in) :: x

Return Value integer(kind=int16)

public recursive function factorial_int32(x) result(x_fact)

Recursively compute the factorial of a 32-bit integer. The max value that can be passed is 16 If x is less than 0 or greater 16, the function will return 0

Arguments

Type IntentOptional AttributesName
integer(kind=int32), intent(in) :: x

Return Value integer(kind=int32)

public recursive function factorial_int64(x) result(x_fact)

Recursively compute the factorial of a 64-bit integer. The max value that can be passed is 20 If x is less than 0 or greater 20, the function will return 0

Arguments

Type IntentOptional AttributesName
integer(kind=int64), intent(in) :: x

Return Value integer(kind=int64)

public recursive function factorial_int128(x) result(x_fact)

Recursively compute the factorial of a 128-bit integer [supported on gfortran]. The max value that can be passed is 33 If x is less than 0 or greater 33, the function will return 0

Arguments

Type IntentOptional AttributesName
integer(kind=int128), intent(in) :: x

Return Value integer(kind=int128)

public function exp_series_r32(x) result(exp)

Compute using a taylor series with 12 terms

Arguments

Type IntentOptional AttributesName
real(kind=real32), intent(in) :: x

Return Value real

public function exp_series_r64(x) result(exp)

Calculate using a taylor series with 20 terms

Arguments

Type IntentOptional AttributesName
real(kind=real64), intent(in) :: x

Return Value real(kind=real64)

public function sind_series(x_, n_) result(sin_x)

Compute sine using a truncated taylor series

Arguments

Type IntentOptional AttributesName
real, intent(in) :: x_

Angle in degrees

integer, intent(in) :: n_

Number of terms to use

Return Value real

public function nth_root_r32(x_, n_) result(root_)

Arguments

Type IntentOptional AttributesName
real(kind=real32), intent(in) :: x_
integer, intent(in) :: n_

Return Value real(kind=real32)

public function nth_root_r64(x_, n_) result(root_)

Arguments

Type IntentOptional AttributesName
real(kind=real64), intent(in) :: x_
integer, intent(in) :: n_

Return Value real(kind=real64)

public function fibonacci_loop(n) result(f_n)

Update current F number Update previous two numbers

Arguments

Type IntentOptional AttributesName
integer(kind=int64), intent(in) :: n

Nth fibonacci to compute

Return Value integer(kind=int64)