LLVM  4.0.0
Classes | Public Member Functions | Friends | List of all members
llvm::detail::IEEEFloat Class Referencefinal

#include <APFloat.h>

Inheritance diagram for llvm::detail::IEEEFloat:
[legend]
Collaboration diagram for llvm::detail::IEEEFloat:
[legend]

Public Member Functions

bool needsCleanup () const
 Returns whether this instance allocated memory. More...
 
void Profile (FoldingSetNodeID &NID) const
 Used to insert APFloat objects, or objects that contain APFloat objects, into FoldingSets. More...
 
bool operator== (const IEEEFloat &) const =delete
 The definition of equality is not straightforward for floating point, so we won't use operator==. More...
 
cmpResult compare (const IEEEFloat &) const
 IEEE comparison with another floating point number (NaNs compare unordered, 0==-0). More...
 
bool bitwiseIsEqual (const IEEEFloat &) const
 Bitwise comparison for equality (QNaNs compare equal, 0!=-0). More...
 
unsigned int convertToHexString (char *dst, unsigned int hexDigits, bool upperCase, roundingMode) const
 Write out a hexadecimal representation of the floating point value to DST, which must be of sufficient size, in the C99 form [-]0xh.hhhhp[+-]d. More...
 
IEEEFloatoperator= (const IEEEFloat &)
 
IEEEFloatoperator= (IEEEFloat &&)
 
void toString (SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3) const
 Converts this value into a decimal string. More...
 
bool getExactInverse (IEEEFloat *inv) const
 If this value has an exact multiplicative inverse, store it in inv and return true. More...
 
cmpResult compareAbsoluteValue (const IEEEFloat &) const
 
Constructors
 IEEEFloat (const fltSemantics &)
 
 IEEEFloat (const fltSemantics &, integerPart)
 
 IEEEFloat (const fltSemantics &, uninitializedTag)
 
 IEEEFloat (const fltSemantics &, const APInt &)
 
 IEEEFloat (double d)
 
 IEEEFloat (float f)
 
 IEEEFloat (const IEEEFloat &)
 
 IEEEFloat (IEEEFloat &&)
 
 ~IEEEFloat ()
 
Arithmetic
opStatus add (const IEEEFloat &, roundingMode)
 
opStatus subtract (const IEEEFloat &, roundingMode)
 
opStatus multiply (const IEEEFloat &, roundingMode)
 
opStatus divide (const IEEEFloat &, roundingMode)
 
opStatus remainder (const IEEEFloat &)
 IEEE remainder. More...
 
opStatus mod (const IEEEFloat &)
 C fmod, or llvm frem. More...
 
opStatus fusedMultiplyAdd (const IEEEFloat &, const IEEEFloat &, roundingMode)
 
opStatus roundToIntegral (roundingMode)
 
opStatus next (bool nextDown)
 IEEE-754R 5.3.1: nextUp/nextDown. More...
 
IEEEFloat operator+ (const IEEEFloat &RHS) const
 Operator+ overload which provides the default nmNearestTiesToEven rounding mode and no error checking. More...
 
IEEEFloat operator- (const IEEEFloat &RHS) const
 Operator- overload which provides the default nmNearestTiesToEven rounding mode and no error checking. More...
 
IEEEFloat operator* (const IEEEFloat &RHS) const
 Operator* overload which provides the default nmNearestTiesToEven rounding mode and no error checking. More...
 
IEEEFloat operator/ (const IEEEFloat &RHS) const
 Operator/ overload which provides the default nmNearestTiesToEven rounding mode and no error checking. More...
 
Conversions
opStatus convert (const fltSemantics &, roundingMode, bool *)
 IEEEFloat::convert - convert a value of one floating point type to another. More...
 
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
 
IEEE-754R 5.7.2 General operations.
bool isNegative () const
 IEEE-754R isSignMinus: Returns true if and only if the current value is negative. More...
 
bool isNormal () const
 IEEE-754R isNormal: Returns true if and only if the current value is normal. More...
 
bool isFinite () const
 Returns true if and only if the current value is zero, subnormal, or normal. More...
 
bool isZero () const
 Returns true if and only if the float is plus or minus zero. More...
 
bool isDenormal () const
 IEEE-754R isSubnormal(): Returns true if and only if the float is a denormal. More...
 
bool isInfinity () const
 IEEE-754R isInfinite(): Returns true if and only if the float is infinity. More...
 
bool isNaN () const
 Returns true if and only if the float is a quiet or signaling NaN. More...
 
bool isSignaling () const
 Returns true if and only if the float is a signaling NaN. More...
 
Special value setters.
void makeLargest (bool Neg=false)
 Make this number the largest magnitude normal number in the given semantics. More...
 
void makeSmallest (bool Neg=false)
 Make this number the smallest magnitude denormal number in the given semantics. More...
 
void makeNaN (bool SNaN=false, bool Neg=false, const APInt *fill=nullptr)
 
void makeInf (bool Neg=false)
 
void makeZero (bool Neg=false)
 
void makeQuiet ()
 
void makeSmallestNormalized (bool Negative=false)
 Returns the smallest (by magnitude) normalized finite number in the given semantics. More...
 

Friends

hash_code hash_value (const IEEEFloat &Arg)
 Overload to compute a hash code for an APFloat value. More...
 
int ilogb (const IEEEFloat &Arg)
 Returns the exponent of the internal representation of the APFloat. More...
 
IEEEFloat scalbn (IEEEFloat X, int Exp, roundingMode)
 Returns: X * 2^Exp for integral exponents. More...
 
IEEEFloat frexp (const IEEEFloat &X, int &Exp, roundingMode)
 

Sign operations.

void changeSign ()
 
void clearSign ()
 
void copySign (const IEEEFloat &)
 
static IEEEFloat copySign (IEEEFloat Value, const IEEEFloat &Sign)
 A static helper to produce a copy of an APFloat value with its sign copied from some other APFloat. More...
 

Simple Queries

fltCategory getCategory () const
 
const fltSemanticsgetSemantics () const
 
bool isNonZero () const
 
bool isFiniteNonZero () const
 
bool isPosZero () const
 
bool isNegZero () const
 
bool isSmallest () const
 Returns true if and only if the number has the smallest possible non-zero magnitude in the current semantics. More...
 
bool isLargest () const
 Returns true if and only if the number has the largest possible finite magnitude in the current semantics. More...
 
bool isInteger () const
 Returns true if and only if the number is an exact integer. More...
 

Additional Inherited Members

- Public Types inherited from llvm::APFloatBase
enum  cmpResult { cmpLessThan, cmpEqual, cmpGreaterThan, cmpUnordered }
 IEEE-754R 5.11: Floating Point Comparison Relations. More...
 
enum  roundingMode {
  rmNearestTiesToEven, rmTowardPositive, rmTowardNegative, rmTowardZero,
  rmNearestTiesToAway
}
 IEEE-754R 4.3: Rounding-direction attributes. More...
 
enum  opStatus {
  opOK = 0x00, opInvalidOp = 0x01, opDivByZero = 0x02, opOverflow = 0x04,
  opUnderflow = 0x08, opInexact = 0x10
}
 IEEE-754R 7: Default exception handling. More...
 
enum  fltCategory { fcInfinity, fcNaN, fcNormal, fcZero }
 Category of internally-represented number. More...
 
enum  uninitializedTag { uninitialized }
 Convenience enum used to construct an uninitialized APFloat. More...
 
enum  IlogbErrorKinds { IEK_Zero = INT_MIN + 1, IEK_NaN = INT_MIN, IEK_Inf = INT_MAX }
 Enumeration of ilogb error results. More...
 
typedef signed short ExponentType
 A signed type to represent a floating point numbers unbiased exponent. More...
 
- Static Public Member Functions inherited from llvm::APFloatBase
static unsigned int semanticsPrecision (const fltSemantics &)
 
static ExponentType semanticsMinExponent (const fltSemantics &)
 
static ExponentType semanticsMaxExponent (const fltSemantics &)
 
static unsigned int semanticsSizeInBits (const fltSemantics &)
 
static unsigned getSizeInBits (const fltSemantics &Sem)
 Returns the size of the floating point number (in bits) in the given semantics. More...
 
static const fltSemanticsIEEEhalf ()
 
static const fltSemanticsIEEEsingle ()
 
static const fltSemanticsIEEEdouble ()
 
static const fltSemanticsIEEEquad ()
 
static const fltSemanticsPPCDoubleDouble ()
 
static const fltSemanticsx87DoubleExtended ()
 
static const fltSemanticsBogus ()
 A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real. More...
 

Detailed Description

Definition at line 213 of file APFloat.h.

Constructor & Destructor Documentation

llvm::detail::IEEEFloat::IEEEFloat ( const fltSemantics ourSemantics)

Definition at line 843 of file APFloat.cpp.

References llvm::APFloatBase::fcZero.

llvm::detail::IEEEFloat::IEEEFloat ( const fltSemantics ourSemantics,
integerPart  value 
)
llvm::detail::IEEEFloat::IEEEFloat ( const fltSemantics ourSemantics,
uninitializedTag  tag 
)

Definition at line 851 of file APFloat.cpp.

llvm::detail::IEEEFloat::IEEEFloat ( const fltSemantics Sem,
const APInt API 
)

Definition at line 3325 of file APFloat.cpp.

llvm::detail::IEEEFloat::IEEEFloat ( double  d)
explicit

Definition at line 3333 of file APFloat.cpp.

References llvm::APInt::doubleToBits(), and llvm::semIEEEdouble.

llvm::detail::IEEEFloat::IEEEFloat ( float  f)
explicit

Definition at line 3329 of file APFloat.cpp.

References llvm::APInt::floatToBits(), and llvm::semIEEEsingle.

llvm::detail::IEEEFloat::IEEEFloat ( const IEEEFloat rhs)

Definition at line 854 of file APFloat.cpp.

llvm::detail::IEEEFloat::IEEEFloat ( IEEEFloat &&  rhs)

Definition at line 859 of file APFloat.cpp.

llvm::detail::IEEEFloat::~IEEEFloat ( )

Definition at line 863 of file APFloat.cpp.

Member Function Documentation

IEEEFloat::opStatus llvm::detail::IEEEFloat::add ( const IEEEFloat ,
roundingMode   
)

Definition at line 1655 of file APFloat.cpp.

Referenced by operator+(), and roundToIntegral().

APInt llvm::detail::IEEEFloat::bitcastToAPInt ( ) const
bool llvm::detail::IEEEFloat::bitwiseIsEqual ( const IEEEFloat rhs) const

Bitwise comparison for equality (QNaNs compare equal, 0!=-0).

Definition at line 816 of file APFloat.cpp.

References llvm::lltok::equal, llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcZero, and isFiniteNonZero().

Referenced by llvm::APFloat::bitwiseIsEqual().

void llvm::detail::IEEEFloat::changeSign ( )

Definition at line 1609 of file APFloat.cpp.

Referenced by llvm::APFloat::changeSign(), next(), and roundToIntegral().

void llvm::detail::IEEEFloat::clearSign ( )

Definition at line 1614 of file APFloat.cpp.

Referenced by llvm::APFloat::clearSign().

IEEEFloat::cmpResult llvm::detail::IEEEFloat::compare ( const IEEEFloat rhs) const
IEEEFloat::cmpResult llvm::detail::IEEEFloat::compareAbsoluteValue ( const IEEEFloat rhs) const
IEEEFloat::opStatus llvm::detail::IEEEFloat::convert ( const fltSemantics ,
roundingMode  ,
bool  
)

IEEEFloat::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).

Definition at line 1943 of file APFloat.cpp.

References llvm::APFloatBase::fcNaN, isFiniteNonZero(), llvm::lfExactlyZero, llvm::fltSemantics::minExponent, llvm::APFloatBase::opOK, llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::semX87DoubleExtended, llvm::shiftRight(), llvm::APInt::tcAssign(), llvm::APInt::tcSet(), llvm::APInt::tcSetBit(), and llvm::APInt::tcShiftLeft().

Referenced by llvm::APFloat::convert().

IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromAPInt ( const APInt ,
bool  ,
roundingMode   
)
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromSignExtendedInteger ( const integerPart ,
unsigned int  ,
bool  ,
roundingMode   
)
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromString ( StringRef  ,
roundingMode   
)
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromZeroExtendedInteger ( const integerPart ,
unsigned int  ,
bool  ,
roundingMode   
)
double llvm::detail::IEEEFloat::convertToDouble ( ) const
float llvm::detail::IEEEFloat::convertToFloat ( ) const
unsigned int llvm::detail::IEEEFloat::convertToHexString ( char *  dst,
unsigned int  hexDigits,
bool  upperCase,
roundingMode   
) const

Write out a hexadecimal representation of the floating point value to DST, which must be of sufficient size, in the C99 form [-]0xh.hhhhp[+-]d.

Return the number of characters written, excluding the terminating NUL.

Definition at line 2651 of file APFloat.cpp.

References llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::infinityL, llvm::infinityU, llvm::NaNL, and llvm::NaNU.

Referenced by llvm::APFloat::convertToHexString().

opStatus llvm::detail::IEEEFloat::convertToInteger ( integerPart ,
unsigned  int,
bool  ,
roundingMode  ,
bool  
) const
opStatus llvm::detail::IEEEFloat::convertToInteger ( APSInt ,
roundingMode  ,
bool  
) const
void llvm::detail::IEEEFloat::copySign ( const IEEEFloat rhs)

Definition at line 1619 of file APFloat.cpp.

Referenced by copySign(), llvm::APFloat::copySign(), and roundToIntegral().

static IEEEFloat llvm::detail::IEEEFloat::copySign ( IEEEFloat  Value,
const IEEEFloat Sign 
)
inlinestatic

A static helper to produce a copy of an APFloat value with its sign copied from some other APFloat.

Definition at line 301 of file APFloat.h.

References copySign().

IEEEFloat::opStatus llvm::detail::IEEEFloat::divide ( const IEEEFloat ,
roundingMode   
)
IEEEFloat::opStatus llvm::detail::IEEEFloat::fusedMultiplyAdd ( const IEEEFloat ,
const IEEEFloat ,
roundingMode   
)
fltCategory llvm::detail::IEEEFloat::getCategory ( ) const
inline

Definition at line 387 of file APFloat.h.

Referenced by llvm::APFloat::getCategory().

bool llvm::detail::IEEEFloat::getExactInverse ( IEEEFloat inv) const

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

Definition at line 3623 of file APFloat.cpp.

References assert(), divide(), isDenormal(), isFiniteNonZero(), llvm::APFloatBase::opOK, llvm::fltSemantics::precision, and llvm::APFloatBase::rmNearestTiesToEven.

Referenced by llvm::APFloat::getExactInverse().

const fltSemantics& llvm::detail::IEEEFloat::getSemantics ( ) const
inline

Definition at line 388 of file APFloat.h.

Referenced by llvm::detail::ilogb(), and llvm::detail::scalbn().

bool llvm::detail::IEEEFloat::isDenormal ( ) const

IEEE-754R isSubnormal(): Returns true if and only if the float is a denormal.

Definition at line 743 of file APFloat.cpp.

References isFiniteNonZero(), llvm::fltSemantics::minExponent, llvm::fltSemantics::precision, and llvm::APInt::tcExtractBit().

Referenced by getExactInverse(), llvm::detail::ilogb(), llvm::APFloat::isDenormal(), isNormal(), and next().

bool llvm::detail::IEEEFloat::isFinite ( ) const
inline

Returns true if and only if the current value is zero, subnormal, or normal.

This means that the value is not infinite or NaN.

Definition at line 364 of file APFloat.h.

References isInfinity(), and isNaN().

Referenced by fusedMultiplyAdd(), isFiniteNonZero(), and isInteger().

bool llvm::detail::IEEEFloat::isFiniteNonZero ( ) const
inline
bool llvm::detail::IEEEFloat::isInfinity ( ) const
inline

IEEE-754R isInfinite(): Returns true if and only if the float is infinity.

Definition at line 374 of file APFloat.h.

References llvm::APFloatBase::fcInfinity.

Referenced by llvm::detail::ilogb(), and isFinite().

bool llvm::detail::IEEEFloat::isInteger ( ) const

Returns true if and only if the number is an exact integer.

Definition at line 808 of file APFloat.cpp.

References llvm::APFloatBase::cmpEqual, compare(), isFinite(), llvm::APFloatBase::rmTowardZero, and roundToIntegral().

Referenced by llvm::APFloat::isInteger().

bool llvm::detail::IEEEFloat::isLargest ( ) const

Returns true if and only if the number has the largest possible finite magnitude in the current semantics.

Definition at line 801 of file APFloat.cpp.

References isFiniteNonZero(), and llvm::fltSemantics::maxExponent.

Referenced by llvm::APFloat::isLargest(), and next().

bool llvm::detail::IEEEFloat::isNaN ( ) const
inline

Returns true if and only if the float is a quiet or signaling NaN.

Definition at line 377 of file APFloat.h.

References llvm::APFloatBase::fcNaN.

Referenced by llvm::detail::hash_value(), llvm::detail::ilogb(), isFinite(), isSignaling(), makeQuiet(), and llvm::detail::scalbn().

bool llvm::detail::IEEEFloat::isNegative ( ) const
inline

IEEE-754R isSignMinus: Returns true if and only if the current value is negative.

This applies to zeros and NaNs as well.

Definition at line 352 of file APFloat.h.

Referenced by llvm::APFloat::isNegative(), isNegZero(), isPosZero(), next(), roundToIntegral(), and toString().

bool llvm::detail::IEEEFloat::isNegZero ( ) const
inline

Definition at line 392 of file APFloat.h.

References isNegative(), and isZero().

bool llvm::detail::IEEEFloat::isNonZero ( ) const
inline

Definition at line 389 of file APFloat.h.

References llvm::APFloatBase::fcZero.

bool llvm::detail::IEEEFloat::isNormal ( ) const
inline

IEEE-754R isNormal: Returns true if and only if the current value is normal.

This implies that the current value of the float is not zero, subnormal, infinite, or NaN following the definition of normality from IEEE-754R.

Definition at line 358 of file APFloat.h.

References isDenormal(), and isFiniteNonZero().

bool llvm::detail::IEEEFloat::isPosZero ( ) const
inline

Definition at line 391 of file APFloat.h.

References isNegative(), and isZero().

bool llvm::detail::IEEEFloat::isSignaling ( ) const

Returns true if and only if the float is a signaling NaN.

Definition at line 3652 of file APFloat.cpp.

References isNaN(), llvm::fltSemantics::precision, and llvm::APInt::tcExtractBit().

Referenced by llvm::APFloat::isSignaling(), and next().

bool llvm::detail::IEEEFloat::isSmallest ( ) const

Returns true if and only if the number has the smallest possible non-zero magnitude in the current semantics.

Definition at line 749 of file APFloat.cpp.

References isFiniteNonZero(), and llvm::fltSemantics::minExponent.

Referenced by llvm::APFloat::isSmallest(), and next().

bool llvm::detail::IEEEFloat::isZero ( ) const
inline

Returns true if and only if the float is plus or minus zero.

Definition at line 367 of file APFloat.h.

References llvm::APFloatBase::fcZero.

Referenced by llvm::detail::ilogb(), isFiniteNonZero(), isNegZero(), isPosZero(), mod(), and remainder().

void llvm::detail::IEEEFloat::makeInf ( bool  Neg = false)
void llvm::detail::IEEEFloat::makeLargest ( bool  Negative = false)

Make this number the largest magnitude normal number in the given semantics.

Definition at line 3275 of file APFloat.cpp.

References llvm::APFloatBase::fcNormal, llvm::integerPartWidth, llvm::fltSemantics::maxExponent, and llvm::fltSemantics::precision.

Referenced by next().

void llvm::detail::IEEEFloat::makeNaN ( bool  SNaN = false,
bool  Neg = false,
const APInt fill = nullptr 
)
void llvm::detail::IEEEFloat::makeQuiet ( )
void llvm::detail::IEEEFloat::makeSmallest ( bool  Negative = false)

Make this number the smallest magnitude denormal number in the given semantics.

Definition at line 3300 of file APFloat.cpp.

References llvm::APFloatBase::fcNormal, llvm::fltSemantics::minExponent, and llvm::APInt::tcSet().

Referenced by next().

void llvm::detail::IEEEFloat::makeSmallestNormalized ( bool  Negative = false)

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

Parameters
Negative- True iff the number should be negative

Definition at line 3311 of file APFloat.cpp.

References llvm::APFloatBase::fcNormal, llvm::fltSemantics::minExponent, llvm::partCountForBits(), and llvm::fltSemantics::precision.

void llvm::detail::IEEEFloat::makeZero ( bool  Neg = false)
IEEEFloat::opStatus llvm::detail::IEEEFloat::mod ( const IEEEFloat rhs)
IEEEFloat::opStatus llvm::detail::IEEEFloat::multiply ( const IEEEFloat ,
roundingMode   
)
bool llvm::detail::IEEEFloat::needsCleanup ( ) const
inline

Returns whether this instance allocated memory.

Definition at line 231 of file APFloat.h.

IEEEFloat::opStatus llvm::detail::IEEEFloat::next ( bool  nextDown)
IEEEFloat llvm::detail::IEEEFloat::operator* ( const IEEEFloat RHS) const
inline

Operator* overload which provides the default nmNearestTiesToEven rounding mode and no error checking.

Definition at line 276 of file APFloat.h.

References multiply(), and llvm::APFloatBase::rmNearestTiesToEven.

IEEEFloat llvm::detail::IEEEFloat::operator+ ( const IEEEFloat RHS) const
inline

Operator+ overload which provides the default nmNearestTiesToEven rounding mode and no error checking.

Definition at line 260 of file APFloat.h.

References add(), and llvm::APFloatBase::rmNearestTiesToEven.

IEEEFloat llvm::detail::IEEEFloat::operator- ( const IEEEFloat RHS) const
inline

Operator- overload which provides the default nmNearestTiesToEven rounding mode and no error checking.

Definition at line 268 of file APFloat.h.

References llvm::APFloatBase::rmNearestTiesToEven, and subtract().

IEEEFloat llvm::detail::IEEEFloat::operator/ ( const IEEEFloat RHS) const
inline

Operator/ overload which provides the default nmNearestTiesToEven rounding mode and no error checking.

Definition at line 284 of file APFloat.h.

References divide(), and llvm::APFloatBase::rmNearestTiesToEven.

IEEEFloat & llvm::detail::IEEEFloat::operator= ( const IEEEFloat rhs)

Definition at line 718 of file APFloat.cpp.

IEEEFloat & llvm::detail::IEEEFloat::operator= ( IEEEFloat &&  rhs)

Definition at line 730 of file APFloat.cpp.

References llvm::semBogus.

bool llvm::detail::IEEEFloat::operator== ( const IEEEFloat ) const
delete

The definition of equality is not straightforward for floating point, so we won't use operator==.

Use one of the following, or write whatever it is you really mean.

void llvm::detail::IEEEFloat::Profile ( FoldingSetNodeID NID) const

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

Definition at line 866 of file APFloat.cpp.

References llvm::FoldingSetNodeID::Add(), and bitcastToAPInt().

Referenced by llvm::APFloat::Profile().

IEEEFloat::opStatus llvm::detail::IEEEFloat::remainder ( const IEEEFloat rhs)
IEEEFloat::opStatus llvm::detail::IEEEFloat::roundToIntegral ( roundingMode  )
IEEEFloat::opStatus llvm::detail::IEEEFloat::subtract ( const IEEEFloat ,
roundingMode   
)

Definition at line 1661 of file APFloat.cpp.

Referenced by mod(), operator-(), remainder(), and roundToIntegral().

void llvm::detail::IEEEFloat::toString ( SmallVectorImpl< char > &  Str,
unsigned  FormatPrecision = 0,
unsigned  FormatMaxPadding = 3 
) const

Converts this value into a decimal string.

Parameters
FormatPrecisionThe 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.
FormatMaxPaddingThe 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

Definition at line 3421 of file APFloat.cpp.

References llvm::sys::path::append(), assert(), llvm::APInt::countTrailingZeros(), E, llvm::SmallVectorBase::empty(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::APInt::getBitWidth(), llvm::APInt::getZExtValue(), I, isNegative(), llvm::APInt::lshr(), llvm::makeArrayRef(), llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::SmallVectorTemplateBase< T, isPodLike >::push_back(), llvm::SmallVectorTemplateCommon< T >::size(), llvm::SmallVectorTemplateCommon< T, typename >::size(), llvm::APInt::udivrem(), and llvm::APInt::zext().

Referenced by llvm::APFloat::toString().

Friends And Related Function Documentation

IEEEFloat frexp ( const IEEEFloat X,
int &  Exp,
roundingMode   
)
friend
hash_code hash_value ( const IEEEFloat Arg)
friend

Overload to compute a hash code for an APFloat value.

Note that the use of hash codes for floating point values is in general frought with peril. Equality is hard to define for these values. For example, should negative and positive zero hash to different codes? Are they equal or not? This hash value implementation specifically emphasizes producing different codes for different inputs in order to be used in canonicalization and memoization. As such, equality is bitwiseIsEqual, and 0 != -0.

Definition at line 2800 of file APFloat.cpp.

int ilogb ( const IEEEFloat Arg)
friend

Returns the exponent of the internal representation of the APFloat.

Because the radix of APFloat is 2, this is equivalent to floor(log2(x)). For special APFloat values, this returns special error codes:

NaN -> IEK_NaN 0 -> IEK_Zero Inf -> IEK_Inf

Definition at line 3800 of file APFloat.cpp.

IEEEFloat scalbn ( IEEEFloat  X,
int  Exp,
roundingMode   
)
friend

Returns: X * 2^Exp for integral exponents.


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