A 3D Dynamic Geometry Software

Calques 3D C++



CFraction Class Reference
[CFraction Library : Code for handling fraction strings]

Collaboration diagram for CFraction:

Collaboration graph

List of all members.


Detailed Description

CFraction - Code for handling fraction strings.

Author:
Dean Wyant dwyant@mindspring.com
CFraction - This class is used like a double. Do anything you would do with a double, plus assign strings to it. When you need to get a string representation, use one of the String calls. My favorite is ForceToStockString which returns a string for the closest valid stock transaction denominator up to MaxDen (default 256). This is great for applications that need to show stock prices in fractions without resorting to a table lookup or showing unusual prices in decimal.

C calls and plain calls for ASCIIZ support are provided.

A description of the Fraction Algorithm is also given.


Public Member Functions

CString ToString (double AllowedError=FRACTION_MAX_PRECISION)
 See Fracftoa.
CString ToString (int MaxDen)
 See Fracftoa.
CString ToStockString (int MaxDen=256)
 See DoubleToStockString.
CString ForceToStockString (int MaxDen=256)
 See ForceDoubleToStockString.

Private Attributes

double m_d
 Internal storage for the double.

Member Function Documentation

CString ToString ( double  AllowedError = FRACTION_MAX_PRECISION  ) 

See Fracftoa.

CString ToString ( int  MaxDen  ) 

See Fracftoa.

CString ToStockString ( int  MaxDen = 256  ) 

CString ForceToStockString ( int  MaxDen = 256  ) 


Member Data Documentation

double m_d [private]

Internal storage for the double.