DollarFr(DecimalValue: Double; Fraction: Integer): Double;
DollarFr(DecimalValue: double; Fraction: integer): double;
Parameters | Description | Constraints |
DecimalValue | 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 DollarFr method is used to convert a ruble price expressed as a decimal number to a ruble price expressed as a fraction.
DollarFr is calculated using the following formula:
DollarFr = 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.DollarFr(1.125, 16);
Debug.WriteLine(r);
End Sub UserProc;
After executing the example the console window displays the transformation equal to 1.02. The example transforms the decimal number 1.125 into the number read as 1 integer and 2/16 and written as 1.02.
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.DollarFr(1.125, 16);
System.Diagnostics.Debug.WriteLine(r);
End Sub;
See also: