Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

TxqFloatingDecimal Class Reference

The class TxFloatingDouble determines the exponent and digits for a double, using QString's number method to convert to a QString object. More...

#include <TxqFloatingDecimal.h>

List of all members.

Public Methods

 TxqFloatingDecimal (double num)
 Constructs from a double. More...

 TxqFloatingDecimal (double num, int digits)
 Construct from a double and with the number of requested digits. More...

 TxqFloatingDecimal (float num)
 Constructs from a float. More...

int getSign ()
 Get the sign of the number. More...

int getExponentSign ()
 Get the sign of the exponent. More...

int getExponent ()
 Get the exponent of the number. More...

QString getStringDigits ()
 gets the requested number of digits and returns as a QString. More...

int getDigit ()
 Gets the next digit. More...

double getNumber ()
 Get the number being used. More...

void setNumDigits (int n)
 Sets the number of digits. More...

bool isNegative ()
 Determines if the number is negative. More...

bool isExceptional ()
 Determines if the number is valid. More...

 ~TxqFloatingDecimal ()
 The destructor. More...


Private Methods

void reformat ()
 Reformat the input number to a QString containing numDigits; The reformatted digits will be contained in stringNumber. More...


Private Attributes

double reformNumber
 The reformat number. More...

double digitNumber
 The digit number which is the absolute value of the number. More...

QString stringNumber
 The QString represenation of the number. More...

int stringIndex
 An integer index into the string. More...

int exponent
 The exponent as an integer value. More...

double number
 The number to use to convert. More...

int sign
 The sign of the number. More...

int numDigits
 The requested number of digits. More...

bool pastDecimal
 A bool to determine if past the decimal point. More...

bool pastFirstDecimal
 A bool to determine if first number past the decimal point. More...

bool posExp
 A bool to determine if a positive exponent. More...


Detailed Description

The class TxFloatingDouble determines the exponent and digits for a double, using QString's number method to convert to a QString object.

This class should only be used for plotting numbers on a graph since the digit retrieval is approximate for some cases, but accurate for most.

Author:
Kelly G. Luetkemeyer

Version:
Id:
TxqFloatingDecimal.h,v 1.6 2001/10/12 18:51:23 kgl Exp

Definition at line 44 of file TxqFloatingDecimal.h.


Constructor & Destructor Documentation

TxqFloatingDecimal::TxqFloatingDecimal ( double num ) [inline]
 

Constructs from a double.

Parameters:
num   the double value

Definition at line 53 of file TxqFloatingDecimal.h.

Referenced by TxqFloatingDecimal().

TxqFloatingDecimal::TxqFloatingDecimal ( double num,
int digits ) [inline]
 

Construct from a double and with the number of requested digits.

Parameters:
num   the double value
digits   the number of requested digits

Definition at line 67 of file TxqFloatingDecimal.h.

TxqFloatingDecimal::TxqFloatingDecimal ( float num ) [inline]
 

Constructs from a float.

Parameters:
num   the float value

Definition at line 79 of file TxqFloatingDecimal.h.

TxqFloatingDecimal::~TxqFloatingDecimal ( ) [inline]
 

The destructor.

Definition at line 173 of file TxqFloatingDecimal.h.


Member Function Documentation

int TxqFloatingDecimal::getDigit ( ) [inline]
 

Gets the next digit.

Returns:
the next digit

Definition at line 124 of file TxqFloatingDecimal.h.

Referenced by TxqSciNumberFormat::format().

int TxqFloatingDecimal::getExponent ( ) [inline]
 

Get the exponent of the number.

Returns:
the exponent without a sign

Definition at line 106 of file TxqFloatingDecimal.h.

Referenced by TxqSciNumberFormat::format().

int TxqFloatingDecimal::getExponentSign ( ) [inline]
 

Get the sign of the exponent.

Returns:
the sign of the exponent. returns 0 of the exponent is 0

Definition at line 96 of file TxqFloatingDecimal.h.

Referenced by TxqSciNumberFormat::format().

double TxqFloatingDecimal::getNumber ( ) [inline]
 

Get the number being used.

Returns:
the number

Definition at line 138 of file TxqFloatingDecimal.h.

int TxqFloatingDecimal::getSign ( ) [inline]
 

Get the sign of the number.

Returns:
the sign

Definition at line 87 of file TxqFloatingDecimal.h.

Referenced by isNegative().

QString TxqFloatingDecimal::getStringDigits ( ) [inline]
 

gets the requested number of digits and returns as a QString.

Returns:
the QString representation of the number.

Definition at line 116 of file TxqFloatingDecimal.h.

bool TxqFloatingDecimal::isExceptional ( ) [inline]
 

Determines if the number is valid.

Returns:
true if the number is outside the valid ranges or is NaN

Definition at line 164 of file TxqFloatingDecimal.h.

Referenced by TxqSciNumberFormat::format().

bool TxqFloatingDecimal::isNegative ( ) [inline]
 

Determines if the number is negative.

Returns:
true if the number is negative

Definition at line 154 of file TxqFloatingDecimal.h.

Referenced by TxqSciNumberFormat::format().

void TxqFloatingDecimal::reformat ( ) [inline, private]
 

Reformat the input number to a QString containing numDigits; The reformatted digits will be contained in stringNumber.

This alogrithm is not based on using the log of the number and moving digits since that is prone to round-off error. (The earlier cvs algorithm)

Definition at line 186 of file TxqFloatingDecimal.h.

Referenced by TxqFloatingDecimal(), and setNumDigits().

void TxqFloatingDecimal::setNumDigits ( int n ) [inline]
 

Sets the number of digits.

Definition at line 145 of file TxqFloatingDecimal.h.


Member Data Documentation

double TxqFloatingDecimal::digitNumber [private]
 

The digit number which is the absolute value of the number.

Definition at line 331 of file TxqFloatingDecimal.h.

int TxqFloatingDecimal::exponent [private]
 

The exponent as an integer value.

Definition at line 346 of file TxqFloatingDecimal.h.

int TxqFloatingDecimal::numDigits [private]
 

The requested number of digits.

Definition at line 361 of file TxqFloatingDecimal.h.

double TxqFloatingDecimal::number [private]
 

The number to use to convert.

Definition at line 351 of file TxqFloatingDecimal.h.

bool TxqFloatingDecimal::pastDecimal [private]
 

A bool to determine if past the decimal point.

Definition at line 366 of file TxqFloatingDecimal.h.

bool TxqFloatingDecimal::pastFirstDecimal [private]
 

A bool to determine if first number past the decimal point.

Definition at line 371 of file TxqFloatingDecimal.h.

bool TxqFloatingDecimal::posExp [private]
 

A bool to determine if a positive exponent.

Definition at line 376 of file TxqFloatingDecimal.h.

double TxqFloatingDecimal::reformNumber [private]
 

The reformat number.

Definition at line 326 of file TxqFloatingDecimal.h.

int TxqFloatingDecimal::sign [private]
 

The sign of the number.

Definition at line 356 of file TxqFloatingDecimal.h.

int TxqFloatingDecimal::stringIndex [private]
 

An integer index into the string.

Definition at line 341 of file TxqFloatingDecimal.h.

QString TxqFloatingDecimal::stringNumber [private]
 

The QString represenation of the number.

Definition at line 336 of file TxqFloatingDecimal.h.


The documentation for this class was generated from the following file: Copyright Tech-X Corporation, all rights reserved.