Example: Price Conversion - Decimal Dollars

A decimal dollar price, in this case $1.38, is converted to a fractional price.
using System;
using Imsl.Finance;

public class dollarfrEx1
{
    public static void  Main(String[] args)
    {
        double decimalDollar = 1.38;
        int fraction = 8;
        
        double dollarfrc = Finance.Dollarfr(decimalDollar, fraction);
        Console.Out.WriteLine("The decimal dollar $1.38 as a fractional"
                              + " dollar = " + 
                              dollarfrc.ToString("0.00"));
    }
}

Output

The decimal dollar $1.38 as a fractional dollar = 1.30

Link to C# source.