llvm::APFloat Class Reference

#include <APFloat.h>

List of all members.

Classes

union  Significand

Public Types

enum  cmpResult { cmpLessThan, cmpEqual, cmpGreaterThan, cmpUnordered }
enum  roundingMode {
  rmNearestTiesToEven, rmTowardPositive, rmTowardNegative, rmTowardZero,
  rmNearestTiesToAway
}
enum  opStatus {
  opOK = 0x00, opInvalidOp = 0x01, opDivByZero = 0x02, opOverflow = 0x04,
  opUnderflow = 0x08, opInexact = 0x10
}
enum  fltCategory { fcInfinity, fcNaN, fcNormal, fcZero }
enum  uninitializedTag { uninitialized }

Public Member Functions

 APFloat (const fltSemantics &)
 APFloat (const fltSemantics &, StringRef)
 APFloat (const fltSemantics &, integerPart)
 APFloat (const fltSemantics &, fltCategory, bool negative)
 APFloat (const fltSemantics &, uninitializedTag)
 APFloat (double d)
 APFloat (float f)
 APFloat (const APInt &, bool isIEEE=false)
 APFloat (const APFloat &)
 ~APFloat ()
void Profile (FoldingSetNodeID &NID) const
 Profile - Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.
void Emit (Serializer &S) const
 Used by the Bitcode serializer to emit APInts to Bitcode.
opStatus add (const APFloat &, roundingMode)
opStatus subtract (const APFloat &, roundingMode)
opStatus multiply (const APFloat &, roundingMode)
opStatus divide (const APFloat &, roundingMode)
opStatus remainder (const APFloat &)
opStatus mod (const APFloat &, roundingMode)
opStatus fusedMultiplyAdd (const APFloat &, const APFloat &, roundingMode)
void changeSign ()
void clearSign ()
void copySign (const APFloat &)
opStatus convert (const fltSemantics &, roundingMode, bool *)
 APFloat::convert - convert a value of one floating point type to another.
opStatus convertToInteger (integerPart *, unsigned int, bool, roundingMode, bool *) const
opStatus convertToInteger (APSInt &, roundingMode, bool *) const
opStatus convertFromAPInt (const APInt &, bool, roundingMode)
opStatus convertFromSignExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromZeroExtendedInteger (const integerPart *, unsigned int, bool, roundingMode)
opStatus convertFromString (StringRef, roundingMode)
APInt bitcastToAPInt () const
double convertToDouble () const
float convertToFloat () const
cmpResult compare (const APFloat &) const
bool bitwiseIsEqual (const APFloat &) const
unsigned int convertToHexString (char *dst, unsigned int hexDigits, bool upperCase, roundingMode) const
fltCategory getCategory () const
const fltSemanticsgetSemantics () const
bool isZero () const
bool isNonZero () const
bool isNaN () const
bool isInfinity () const
bool isNegative () const
bool isPosZero () const
bool isNegZero () const
APFloatoperator= (const APFloat &)
uint32_t getHashValue () const
void toString (SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3) const
 Converts this value into a decimal string.
bool getExactInverse (APFloat *inv) const
 getExactInverse - If this value has an exact multiplicative inverse, store it in inv and return true.

Static Public Member Functions

static unsigned int semanticsPrecision (const fltSemantics &)
static APFloat getZero (const fltSemantics &Sem, bool Negative=false)
static APFloat getInf (const fltSemantics &Sem, bool Negative=false)
static APFloat getNaN (const fltSemantics &Sem, bool Negative=false, unsigned type=0)
 getNaN - Factory for QNaN values.
static APFloat getQNaN (const fltSemantics &Sem, bool Negative=false, const APInt *payload=0)
 getQNan - Factory for QNaN values.
static APFloat getSNaN (const fltSemantics &Sem, bool Negative=false, const APInt *payload=0)
 getSNan - Factory for SNaN values.
static APFloat getLargest (const fltSemantics &Sem, bool Negative=false)
 getLargest - Returns the largest finite number in the given semantics.
static APFloat getSmallest (const fltSemantics &Sem, bool Negative=false)
 getSmallest - Returns the smallest (by magnitude) finite number in the given semantics.
static APFloat getSmallestNormalized (const fltSemantics &Sem, bool Negative=false)
 getSmallestNormalized - Returns the smallest (by magnitude) normalized finite number in the given semantics.
static APFloat getAllOnesValue (unsigned BitWidth, bool isIEEE=false)
 getAllOnesValue - Returns a float which is bitcasted from an all one value int.
static APFloat ReadVal (Deserializer &D)
 Used by the Bitcode deserializer to deserialize APInts.

Static Public Attributes

static const fltSemantics IEEEhalf = { 15, -14, 11, true }
static const fltSemantics IEEEsingle = { 127, -126, 24, true }
static const fltSemantics IEEEdouble = { 1023, -1022, 53, true }
static const fltSemantics IEEEquad = { 16383, -16382, 113, true }
static const fltSemantics PPCDoubleDouble = { 1023, -1022, 106, false }
static const fltSemantics x87DoubleExtended = { 16383, -16382, 64, true }
static const fltSemantics Bogus = { 0, 0, 0, true }

Private Member Functions

integerPartsignificandParts ()
const integerPartsignificandParts () const
unsigned int partCount () const
integerPart addSignificand (const APFloat &)
integerPart subtractSignificand (const APFloat &, integerPart)
lostFraction addOrSubtractSignificand (const APFloat &, bool subtract)
lostFraction multiplySignificand (const APFloat &, const APFloat *)
lostFraction divideSignificand (const APFloat &)
void incrementSignificand ()
void initialize (const fltSemantics *)
void shiftSignificandLeft (unsigned int)
lostFraction shiftSignificandRight (unsigned int)
unsigned int significandLSB () const
unsigned int significandMSB () const
void zeroSignificand ()
opStatus addOrSubtractSpecials (const APFloat &, bool subtract)
opStatus divideSpecials (const APFloat &)
opStatus multiplySpecials (const APFloat &)
opStatus modSpecials (const APFloat &)
void makeNaN (bool SNaN=false, bool Neg=false, const APInt *fill=0)
opStatus normalize (roundingMode, lostFraction)
opStatus addOrSubtract (const APFloat &, roundingMode, bool subtract)
cmpResult compareAbsoluteValue (const APFloat &) const
opStatus handleOverflow (roundingMode)
bool roundAwayFromZero (roundingMode, lostFraction, unsigned int) const
opStatus convertToSignExtendedInteger (integerPart *, unsigned int, bool, roundingMode, bool *) const
opStatus convertFromUnsignedParts (const integerPart *, unsigned int, roundingMode)
opStatus convertFromHexadecimalString (StringRef, roundingMode)
opStatus convertFromDecimalString (StringRef, roundingMode)
char * convertNormalToHexString (char *, unsigned int, bool, roundingMode) const
opStatus roundSignificandWithExponent (const integerPart *, unsigned int, int, roundingMode)
APInt convertHalfAPFloatToAPInt () const
APInt convertFloatAPFloatToAPInt () const
APInt convertDoubleAPFloatToAPInt () const
APInt convertQuadrupleAPFloatToAPInt () const
APInt convertF80LongDoubleAPFloatToAPInt () const
APInt convertPPCDoubleDoubleAPFloatToAPInt () const
void initFromAPInt (const APInt &api, bool isIEEE=false)
 Treat api as containing the bits of a floating point number.
void initFromHalfAPInt (const APInt &api)
void initFromFloatAPInt (const APInt &api)
void initFromDoubleAPInt (const APInt &api)
void initFromQuadrupleAPInt (const APInt &api)
void initFromF80LongDoubleAPInt (const APInt &api)
 Integer bit is explicit in this format.
void initFromPPCDoubleDoubleAPInt (const APInt &api)
void assign (const APFloat &)
void copySignificand (const APFloat &)
void freeSignificand ()

Static Private Member Functions

static APFloat makeNaN (const fltSemantics &Sem, bool SNaN, bool Negative, const APInt *fill)

Private Attributes

const fltSemanticssemantics
union llvm::APFloat::Significand significand
exponent_t exponent
fltCategory category: 3
unsigned int sign: 1
exponent_t exponent2: 11
unsigned int sign2: 1

Member Enumeration Documentation

Enumerator:
cmpLessThan 
cmpEqual 
cmpGreaterThan 
cmpUnordered 
Enumerator:
fcInfinity 
fcNaN 
fcNormal 
fcZero 
Enumerator:
opOK 
opInvalidOp 
opDivByZero 
opOverflow 
opUnderflow 
opInexact 
Enumerator:
rmNearestTiesToEven 
rmTowardPositive 
rmTowardNegative 
rmTowardZero 
rmNearestTiesToAway 
Enumerator:
uninitialized 

Constructor & Destructor Documentation

APFloat::APFloat ( const fltSemantics ourSemantics  ) 
APFloat::APFloat ( const fltSemantics ourSemantics,
StringRef  text 
)
APFloat::APFloat ( const fltSemantics ourSemantics,
integerPart  value 
)
APFloat::APFloat ( const fltSemantics ourSemantics,
fltCategory  ourCategory,
bool  negative 
)
APFloat::APFloat ( const fltSemantics ourSemantics,
uninitializedTag  tag 
)
APFloat::APFloat ( double  d  )  [explicit]
APFloat::APFloat ( float  f  )  [explicit]
APFloat::APFloat ( const APInt api,
bool  isIEEE = false 
) [explicit]
APFloat::APFloat ( const APFloat rhs  ) 
APFloat::~APFloat (  ) 

Member Function Documentation

APFloat::opStatus APFloat::add ( const APFloat rhs,
roundingMode  rounding_mode 
)
APFloat::opStatus APFloat::addOrSubtract ( const APFloat rhs,
roundingMode  rounding_mode,
bool  subtract 
) [private]
lostFraction APFloat::addOrSubtractSignificand ( const APFloat rhs,
bool  subtract 
) [private]
APFloat::opStatus APFloat::addOrSubtractSpecials ( const APFloat rhs,
bool  subtract 
) [private]
integerPart APFloat::addSignificand ( const APFloat rhs  )  [private]
void APFloat::assign ( const APFloat rhs  )  [private]
APInt APFloat::bitcastToAPInt (  )  const
bool APFloat::bitwiseIsEqual ( const APFloat rhs  )  const
void APFloat::changeSign (  ) 
void APFloat::clearSign (  ) 
APFloat::cmpResult APFloat::compare ( const APFloat rhs  )  const
APFloat::cmpResult APFloat::compareAbsoluteValue ( const APFloat rhs  )  const [private]
APFloat::opStatus APFloat::convert ( const fltSemantics toSemantics,
roundingMode  rounding_mode,
bool *  losesInfo 
)

APFloat::convert - convert a value of one floating point type to another.

The return value corresponds to the IEEE754 exceptions. *losesInfo records whether the transformation lost information, i.e. whether converting the result back to the original type will produce the original value (this is almost the same as return value==fsOK, but there are edge cases where this is not so).

APInt APFloat::convertDoubleAPFloatToAPInt (  )  const [private]
APInt APFloat::convertF80LongDoubleAPFloatToAPInt (  )  const [private]
APInt APFloat::convertFloatAPFloatToAPInt (  )  const [private]
APFloat::opStatus APFloat::convertFromAPInt ( const APInt Val,
bool  isSigned,
roundingMode  rounding_mode 
)
APFloat::opStatus APFloat::convertFromDecimalString ( StringRef  str,
roundingMode  rounding_mode 
) [private]
APFloat::opStatus APFloat::convertFromHexadecimalString ( StringRef  s,
roundingMode  rounding_mode 
) [private]
APFloat::opStatus APFloat::convertFromSignExtendedInteger ( const integerPart src,
unsigned int  srcCount,
bool  isSigned,
roundingMode  rounding_mode 
)
APFloat::opStatus APFloat::convertFromString ( StringRef  str,
roundingMode  rounding_mode 
)
APFloat::opStatus APFloat::convertFromUnsignedParts ( const integerPart src,
unsigned int  srcCount,
roundingMode  rounding_mode 
) [private]
APFloat::opStatus APFloat::convertFromZeroExtendedInteger ( const integerPart parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode 
)
APInt APFloat::convertHalfAPFloatToAPInt (  )  const [private]
char * APFloat::convertNormalToHexString ( char *  dst,
unsigned int  hexDigits,
bool  upperCase,
roundingMode  rounding_mode 
) const [private]
APInt APFloat::convertPPCDoubleDoubleAPFloatToAPInt (  )  const [private]
APInt APFloat::convertQuadrupleAPFloatToAPInt (  )  const [private]
double APFloat::convertToDouble (  )  const
float APFloat::convertToFloat (  )  const
unsigned int APFloat::convertToHexString ( char *  dst,
unsigned int  hexDigits,
bool  upperCase,
roundingMode  rounding_mode 
) const
APFloat::opStatus APFloat::convertToInteger ( APSInt result,
roundingMode  rounding_mode,
bool *  isExact 
) const
APFloat::opStatus APFloat::convertToInteger ( integerPart parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode,
bool *  isExact 
) const
APFloat::opStatus APFloat::convertToSignExtendedInteger ( integerPart parts,
unsigned int  width,
bool  isSigned,
roundingMode  rounding_mode,
bool *  isExact 
) const [private]
void APFloat::copySign ( const APFloat rhs  ) 
void APFloat::copySignificand ( const APFloat rhs  )  [private]
APFloat::opStatus APFloat::divide ( const APFloat rhs,
roundingMode  rounding_mode 
)
lostFraction APFloat::divideSignificand ( const APFloat rhs  )  [private]
APFloat::opStatus APFloat::divideSpecials ( const APFloat rhs  )  [private]
void llvm::APFloat::Emit ( Serializer &  S  )  const

Used by the Bitcode serializer to emit APInts to Bitcode.

void APFloat::freeSignificand (  )  [private]
APFloat::opStatus APFloat::fusedMultiplyAdd ( const APFloat multiplicand,
const APFloat addend,
roundingMode  rounding_mode 
)
APFloat APFloat::getAllOnesValue ( unsigned  BitWidth,
bool  isIEEE = false 
) [static]

getAllOnesValue - Returns a float which is bitcasted from an all one value int.

Parameters:
BitWidth - Select float type
isIEEE - If 128 bit number, select between PPC and IEEE
fltCategory llvm::APFloat::getCategory (  )  const [inline]
bool APFloat::getExactInverse ( APFloat inv  )  const

getExactInverse - If this value has an exact multiplicative inverse, store it in inv and return true.

uint32_t APFloat::getHashValue (  )  const
static APFloat llvm::APFloat::getInf ( const fltSemantics Sem,
bool  Negative = false 
) [inline, static]
APFloat APFloat::getLargest ( const fltSemantics Sem,
bool  Negative = false 
) [static]

getLargest - Returns the largest finite number in the given semantics.

Parameters:
Negative - True iff the number should be negative
static APFloat llvm::APFloat::getNaN ( const fltSemantics Sem,
bool  Negative = false,
unsigned  type = 0 
) [inline, static]

getNaN - Factory for QNaN values.

Parameters:
Negative - True iff the NaN generated should be negative.
type - The unspecified fill bits for creating the NaN, 0 by default. The value is truncated as necessary.
static APFloat llvm::APFloat::getQNaN ( const fltSemantics Sem,
bool  Negative = false,
const APInt payload = 0 
) [inline, static]

getQNan - Factory for QNaN values.

const fltSemantics& llvm::APFloat::getSemantics (  )  const [inline]
APFloat APFloat::getSmallest ( const fltSemantics Sem,
bool  Negative = false 
) [static]

getSmallest - Returns the smallest (by magnitude) finite number in the given semantics.

Might be denormalized, which implies a relative loss of precision.

Parameters:
Negative - True iff the number should be negative
APFloat APFloat::getSmallestNormalized ( const fltSemantics Sem,
bool  Negative = false 
) [static]

getSmallestNormalized - Returns the smallest (by magnitude) normalized finite number in the given semantics.

Parameters:
Negative - True iff the number should be negative
static APFloat llvm::APFloat::getSNaN ( const fltSemantics Sem,
bool  Negative = false,
const APInt payload = 0 
) [inline, static]

getSNan - Factory for SNaN values.

static APFloat llvm::APFloat::getZero ( const fltSemantics Sem,
bool  Negative = false 
) [inline, static]
APFloat::opStatus APFloat::handleOverflow ( roundingMode  rounding_mode  )  [private]
void APFloat::incrementSignificand (  )  [private]
void APFloat::initFromAPInt ( const APInt api,
bool  isIEEE = false 
) [private]

Treat api as containing the bits of a floating point number.

Currently we infer the floating point type from the size of the APInt. The isIEEE argument distinguishes between PPC128 and IEEE128 (not meaningful when the size is anything else).

void APFloat::initFromDoubleAPInt ( const APInt api  )  [private]
void APFloat::initFromF80LongDoubleAPInt ( const APInt api  )  [private]

Integer bit is explicit in this format.

Intel hardware (387 and later) does not support these bit patterns: exponent = all 1's, integer bit 0, significand 0 ("pseudoinfinity") exponent = all 1's, integer bit 0, significand nonzero ("pseudoNaN") exponent = 0, integer bit 1 ("pseudodenormal") exponent!=0 nor all 1's, integer bit 0 ("unnormal") At the moment, the first two are treated as NaNs, the second two as Normal.

void APFloat::initFromFloatAPInt ( const APInt api  )  [private]
void APFloat::initFromHalfAPInt ( const APInt api  )  [private]
void APFloat::initFromPPCDoubleDoubleAPInt ( const APInt api  )  [private]
void APFloat::initFromQuadrupleAPInt ( const APInt api  )  [private]
void APFloat::initialize ( const fltSemantics ourSemantics  )  [private]
bool llvm::APFloat::isInfinity (  )  const [inline]
bool llvm::APFloat::isNaN (  )  const [inline]
bool llvm::APFloat::isNegative (  )  const [inline]
bool llvm::APFloat::isNegZero (  )  const [inline]
bool llvm::APFloat::isNonZero (  )  const [inline]
bool llvm::APFloat::isPosZero (  )  const [inline]
bool llvm::APFloat::isZero (  )  const [inline]
void APFloat::makeNaN ( bool  SNaN = false,
bool  Neg = false,
const APInt fill = 0 
) [private]
APFloat APFloat::makeNaN ( const fltSemantics Sem,
bool  SNaN,
bool  Negative,
const APInt fill 
) [static, private]
APFloat::opStatus APFloat::mod ( const APFloat rhs,
roundingMode  rounding_mode 
)
APFloat::opStatus APFloat::modSpecials ( const APFloat rhs  )  [private]
APFloat::opStatus APFloat::multiply ( const APFloat rhs,
roundingMode  rounding_mode 
)
lostFraction APFloat::multiplySignificand ( const APFloat rhs,
const APFloat addend 
) [private]
APFloat::opStatus APFloat::multiplySpecials ( const APFloat rhs  )  [private]
APFloat::opStatus APFloat::normalize ( roundingMode  rounding_mode,
lostFraction  lost_fraction 
) [private]
APFloat & APFloat::operator= ( const APFloat rhs  ) 
unsigned int APFloat::partCount (  )  const [private]
void llvm::APFloat::Profile ( FoldingSetNodeID &  NID  )  const

Profile - Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets.

static APFloat llvm::APFloat::ReadVal ( Deserializer &  D  )  [static]

Used by the Bitcode deserializer to deserialize APInts.

APFloat::opStatus APFloat::remainder ( const APFloat rhs  ) 
bool APFloat::roundAwayFromZero ( roundingMode  rounding_mode,
lostFraction  lost_fraction,
unsigned int  bit 
) const [private]
APFloat::opStatus APFloat::roundSignificandWithExponent ( const integerPart decSigParts,
unsigned  int,
int  exp,
roundingMode  rounding_mode 
) [private]
unsigned int APFloat::semanticsPrecision ( const fltSemantics semantics  )  [static]
void APFloat::shiftSignificandLeft ( unsigned int  bits  )  [private]
lostFraction APFloat::shiftSignificandRight ( unsigned int  bits  )  [private]
unsigned int APFloat::significandLSB (  )  const [private]
unsigned int APFloat::significandMSB (  )  const [private]
const integerPart * APFloat::significandParts (  )  const [private]
integerPart * APFloat::significandParts (  )  [private]
APFloat::opStatus APFloat::subtract ( const APFloat rhs,
roundingMode  rounding_mode 
)
integerPart APFloat::subtractSignificand ( const APFloat rhs,
integerPart  borrow 
) [private]
void APFloat::toString ( SmallVectorImpl< char > &  Str,
unsigned  FormatPrecision = 0,
unsigned  FormatMaxPadding = 3 
) const

Converts this value into a decimal string.

Parameters:
FormatPrecision The maximum number of digits of precision to output. If there are fewer digits available, zero padding will not be used unless the value is integral and small enough to be expressed in FormatPrecision digits. 0 means to use the natural precision of the number.
FormatMaxPadding The maximum number of zeros to consider inserting before falling back to scientific notation. 0 means to always use scientific notation.

Number Precision MaxPadding Result ------ --------- ---------- ------ 1.01E+4 5 2 10100 1.01E+4 4 2 1.01E+4 1.01E+4 5 1 1.01E+4 1.01E-2 5 2 0.0101 1.01E-2 4 2 0.0101 1.01E-2 4 1 1.01E-2

void APFloat::zeroSignificand (  )  [private]

Member Data Documentation

const fltSemantics llvm::APFloat::Bogus = { 0, 0, 0, true } [static]
const fltSemantics llvm::APFloat::IEEEdouble = { 1023, -1022, 53, true } [static]
const fltSemantics llvm::APFloat::IEEEhalf = { 15, -14, 11, true } [static]
const fltSemantics llvm::APFloat::IEEEquad = { 16383, -16382, 113, true } [static]
const fltSemantics llvm::APFloat::IEEEsingle = { 127, -126, 24, true } [static]
const fltSemantics llvm::APFloat::PPCDoubleDouble = { 1023, -1022, 106, false } [static]
unsigned int llvm::APFloat::sign [private]
unsigned int llvm::APFloat::sign2 [private]
const fltSemantics llvm::APFloat::x87DoubleExtended = { 16383, -16382, 64, true } [static]

The documentation for this class was generated from the following files:

Generated on 2 Nov 2013 for Galois by  doxygen 1.6.1