CodeCogs - An iteractive open source Numerical library Welcome... Login
CodeCogs
shopping cart
OSXWindowsLinux
Search CodeCogs
Numerical Components

Valid RSS

FinanceBanking

dollar fraction

Available under GPL (Free) and Commercial licence
get a GPL licence
COST (GBP)
this unit 1.56
sub units 0.00
add a commercial licence to your cart
0
viewed 1787 times and licensed 11 times

Finance functions

Controller: CodeCogs  Contact Controller
+View version details
Contents hide toc
buy now     get GPL     add to cart

Interface

#include <codecogs/finance/banking/dollar_fraction.h>

using namespace Finance::Banking;

double dollar_fraction (double decPrice, int frac)
Convert a decimal price to a fractional price.
ExcelReal cc_dollar_fraction (Real decPrice, Integer frac)
This function is available as a Microsoft Excel add-in.

Function Documentation

Dollar Fraction Calculator
  
Add calculator to website or email
 
doubledollar_fractiondoubledecPrice
intfrac )
Converts a decimal price to a fractional price, using the following equation:
iprice+\frac{decimalPrice-iprice}{10^{(ifrac+1)}/fraction}

where iprice is the integer part of decimalPrice and ifrac is the integer part of log(fraction)
Example 1:
#include <stdio.h>
#include <codecogs/finance/banking/dollar_fraction.h>
 
int main()
{
  double d = Finance::Banking::dollar_fraction(1.38, 8);
  printf("The decimal price $1.38 as fractional (8 denominator) = %.1f\n", d);
  return 0;
}
Output:
The decimal price $1.38 as fractional (8 denominator) = 1.3
Parameters:
decPriceis the decimal price.
fracis the denominator required for the fraction output.
Authors:
James Warren (April 2005)
Source Code:

To view or download source code you need either a GPL or Commercial Licence.

buy now     get GPL     add to cart

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


Page Comments

Format Excel Equations

  You must login to leave a messge


Last Modified: 11 Jan 08 @ 01:11     Page Rendered: 2010-03-14 00:10:13

Valid CSS!   Valid XHTML 1.0 Transitional