DollarDe(FractionValue: Double; Fraction: Integer): Double;
DollarDe(FractionValue: double; Fraction: integer): double;
Parameters | Description | Constraints |
FractionValue | The number consisting of integer and fractional parts separated with decimal separator. | Greater or equal to 0. |
Fraction | An integer, which has to be used as a denominator. | Not equal to 0. |
The DollarDe method is used to convert a ruble price expressed as a fraction into a ruble price expressed as a decimal number.
DollarDe is calculated using the following formula:
DollarDe = FV + Value/(0.1k × Fraction),
where:
FV. Integer part of FractionValue.
Value. Fraction part of FractionValue.
k. The least positive number, at which 0.1k × Fraction less than 1.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r: Double;
Begin
r := Finance.DollarDe(1.02, 16);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the transformation equal to 1.125. The example transforms the 1.02 number read as 1 integer and 2/16, into the decimal number 1.125. As the Fraction value is equal to 16, price is expressed up to 1/16 rouble.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
…
Public Shared Sub Main(Params: StartParams);
Var
r: double;
Finance: FinanceClass = New FinanceClass();
Begin
r := Finance.DollarDe(1.02, 16);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: