I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 1.25
sub units 0.00
+
0
FinanceBanking

dollar decimal

Finance functions
Controller: CodeCogs

Interface

C++
Excel

Dollar Decimal

 
doubledollar_decimaldoublefracPrice
intfrac )
Converts a fractional price to a decimal price.

Fractional to decimal conversion is done using the following equation:

where <em>iprice</em> is the integer part of <em>fractionalPrice</em> and <em>ifrac</em> is the integer part of <em>log(fraction)</em>

Example 1

#include <stdio.h>
  #include <codecogs/finance/banking/dollar_decimal.h>
 
  int main()
  {
    double d = Finance::Banking::dollar_decimal(1.3, 8);
    printf("The fractional price $1 3/8 as decimal = %.3f\n", d);
    return 0;
  }
Output
The fractional price $1 3/8 as decimal = 1.375

Parameters

fracPriceis the price, with the value after the decimal being the numerator of the fraction
fracthe denominator of the fraction

Returns

a double representing the decimal price

Authors

James Warren (April 2005)
Source Code

Source code is available when you agree to a GP Licence or buy a Commercial Licence.

Not a member, then Register with CodeCogs. Already a Member, then Login.