fniDecimalUtil128 Module

This module, fniDecimalUtil128 contains procedures for working with decimal strings and the int128 data type.



Functions

public function decToInt128(input, output, startpos, endpos) result(error)
Author
Khang Hoang Nguyen
Since
1n.0.0.f

Parse the input string as a signed decimal integer string to an int128 value.

Read more…

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: input

A string to be parsed as a signed decimal integer string to an int128 value.

integer(kind=k_int128), intent(out) :: output

An int128 value of the input string if no error has occurred during parsing.

integer(kind=k_int32), intent(in), optional :: startpos

An int32 value of the position(inclusive) of where to start parsing.

integer(kind=k_int32), intent(in), optional :: endpos

An int32 value of the position(inclusive) of where to end parsing.

Return Value logical

public function decToInt128TrueError(input, output, startpos, endpos) result(error)
Author
Khang Hoang Nguyen
Since
1n.0.0.f

Parse the input string as a signed decimal integer string to an int128 value.

Read more…

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: input

A string to be parsed as a signed decimal integer string to an int128 value.

integer(kind=k_int128), intent(out) :: output

An int128 value of the input string if no error has occurred during parsing.

integer(kind=k_int32), intent(in), optional :: startpos

An int32 value of the position(inclusive) of where to start parsing.

integer(kind=k_int32), intent(in), optional :: endpos

An int32 value of the position(inclusive) of where to end parsing.

Return Value integer(kind=k_int32)

public function decCompareAsInt128(firstString, secondString, output) result(error)
Author
Khang Hoang Nguyen
Since
1n.0.0.f

Compare two strings as signed decimal integer strings by parsing them to int128 values first.

Read more…

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: firstString

A string to be compared to the string secondString.

character(len=*), intent(in) :: secondString

A string to be compared to the string firstString.

integer(kind=k_int32), intent(out) :: output

An int32 value of 1 if the firstString is larger than the secondString, 0 if they are both equal, or -1 if the firstString is smaller than the secondString. This value may not be a correct value if an error has occurred during parsing either one of the input strings.

Return Value logical

public function decInt128OrSmaller(firstString, secondString)
Author
Khang Hoang Nguyen
Since
1n.0.0.f

Compare two strings bases on the content of the strings reference to int128 values. If the strings are valid signed decimal integer strings that can be parsed to int128 values then they will be compared base on their int128 values. Otherwise, the strings will be compared base on the priority ranking order below.

Read more…

Arguments

Type IntentOptional AttributesName
character(len=*), intent(in) :: firstString

A string to be compared to the string secondString.

character(len=*), intent(in) :: secondString

A string to be compared to the string firstString.

Return Value integer(kind=k_int32)