LLVM
8.0.1
|
#include "llvm/ADT/APFloat.h"
Public Member Functions | |
bool | needsCleanup () const |
Returns whether this instance allocated memory. 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... | |
IEEEFloat & | operator= (const IEEEFloat &) |
IEEEFloat & | operator= (IEEEFloat &&) |
void | toString (SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const |
Converts this value into a decimal string. More... | |
bool | getExactInverse (APFloat *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... | |
Sign operations. | |
void | changeSign () |
Conversions | |
opStatus | convert (const fltSemantics &, roundingMode, bool *) |
IEEEFloat::convert - convert a value of one floating point type to another. More... | |
opStatus | convertToInteger (MutableArrayRef< integerPart >, unsigned int, bool, 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) |
Simple Queries | |
fltCategory | getCategory () const |
const fltSemantics & | getSemantics () 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 APInt::WordType | integerPart |
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 fltSemantics & | IEEEhalf () LLVM_READNONE |
static const fltSemantics & | IEEEsingle () LLVM_READNONE |
static const fltSemantics & | IEEEdouble () LLVM_READNONE |
static const fltSemantics & | IEEEquad () LLVM_READNONE |
static const fltSemantics & | PPCDoubleDouble () LLVM_READNONE |
static const fltSemantics & | x87DoubleExtended () LLVM_READNONE |
static const fltSemantics & | Bogus () LLVM_READNONE |
A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real. More... | |
Static Public Attributes inherited from llvm::APFloatBase | |
static const unsigned | integerPartWidth = APInt::APINT_BITS_PER_WORD |
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics | ) |
Definition at line 860 of file APFloat.cpp.
References initialize().
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics, |
integerPart | value | ||
) |
Definition at line 850 of file APFloat.cpp.
References initialize(), llvm::lfExactlyZero, and llvm::fltSemantics::precision.
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics, |
uninitializedTag | tag | ||
) |
Definition at line 868 of file APFloat.cpp.
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | Sem, |
const APInt & | API | ||
) |
Definition at line 3300 of file APFloat.cpp.
|
explicit |
Definition at line 3308 of file APFloat.cpp.
References llvm::sys::path::append(), llvm::SmallVectorImpl< T >::append(), llvm::StringRef::begin(), llvm::SmallVectorImpl< T >::clear(), llvm::APInt::doubleToBits(), llvm::StringRef::end(), llvm::SmallVectorImpl< T >::erase(), llvm::APInt::getActiveBits(), llvm::APInt::getBitWidth(), I, N, llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase::size(), llvm::APInt::trunc(), and llvm::APInt::udiv().
|
explicit |
Definition at line 3304 of file APFloat.cpp.
References llvm::APInt::floatToBits().
Definition at line 871 of file APFloat.cpp.
llvm::detail::IEEEFloat::IEEEFloat | ( | IEEEFloat && | rhs | ) |
Definition at line 876 of file APFloat.cpp.
llvm::detail::IEEEFloat::~IEEEFloat | ( | ) |
Definition at line 880 of file APFloat.cpp.
References assert(), bits, llvm::combineLostFractions(), convert(), isNonZero(), llvm::lfExactlyHalf, llvm::lfExactlyZero, llvm::lfLessThanHalf, llvm::lfMoreThanHalf, llvm::APFloatBase::opOK, llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::APFloatBase::rmTowardZero, llvm::shiftRight(), llvm::sys::fs::status(), llvm::APInt::tcAdd(), llvm::APInt::tcAssign(), llvm::APInt::tcCompare(), llvm::APInt::tcFullMultiply(), llvm::APInt::tcIncrement(), llvm::APInt::tcIsZero(), llvm::APInt::tcLSB(), llvm::APInt::tcMSB(), llvm::APInt::tcSet(), llvm::APInt::tcSetBit(), llvm::APInt::tcShiftLeft(), and llvm::APInt::tcSubtract().
IEEEFloat::opStatus llvm::detail::IEEEFloat::add | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode | ||
) |
Definition at line 1659 of file APFloat.cpp.
Referenced by convertToDouble(), and roundToIntegral().
APInt llvm::detail::IEEEFloat::bitcastToAPInt | ( | ) | const |
Definition at line 2996 of file APFloat.cpp.
References assert().
Referenced by convertToDouble(), and convertToFloat().
Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
Definition at line 833 of file APFloat.cpp.
References llvm::lltok::equal.
void llvm::detail::IEEEFloat::changeSign | ( | ) |
Definition at line 1623 of file APFloat.cpp.
References assert(), llvm::APFloatBase::fcZero, llvm::lfExactlyZero, llvm::APFloatBase::opDivByZero, and llvm::APFloatBase::rmTowardNegative.
Referenced by next(), and roundToIntegral().
IEEEFloat::cmpResult llvm::detail::IEEEFloat::compare | ( | const IEEEFloat & | rhs | ) | const |
IEEE comparison with another floating point number (NaNs compare unordered, 0==-0).
Definition at line 1851 of file APFloat.cpp.
References assert(), llvm::APFloatBase::cmpEqual, llvm::APFloatBase::cmpGreaterThan, llvm::APFloatBase::cmpLessThan, llvm::APFloatBase::cmpUnordered, compareAbsoluteValue(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm_unreachable, and PackCategoriesIntoKey.
Referenced by compareAbsoluteValue().
IEEEFloat::cmpResult llvm::detail::IEEEFloat::compareAbsoluteValue | ( | const IEEEFloat & | rhs | ) | const |
Definition at line 1187 of file APFloat.cpp.
References assert(), bits, llvm::APFloatBase::cmpEqual, llvm::APFloatBase::cmpGreaterThan, llvm::APFloatBase::cmpLessThan, llvm::combineLostFractions(), compare(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, isFiniteNonZero(), llvm::lfExactlyHalf, llvm::lfExactlyZero, llvm::lfLessThanHalf, llvm::lfMoreThanHalf, LLVM_FALLTHROUGH, llvm_unreachable, makeNaN(), llvm::fltSemantics::maxExponent, llvm::fltSemantics::minExponent, llvm::APFloatBase::opDivByZero, llvm::APFloatBase::opInexact, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::APFloatBase::opOverflow, llvm::APFloatBase::opUnderflow, PackCategoriesIntoKey, llvm::fltSemantics::precision, llvm::reverse(), llvm::APFloatBase::rmNearestTiesToAway, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::rmTowardNegative, llvm::APFloatBase::rmTowardPositive, llvm::APFloatBase::rmTowardZero, subtract(), llvm::APInt::tcCompare(), llvm::APInt::tcExtractBit(), and llvm::APInt::tcSetLeastSignificantBits().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convert | ( | const fltSemantics & | toSemantics, |
roundingMode | rounding_mode, | ||
bool * | losesInfo | ||
) |
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 1928 of file APFloat.cpp.
References assert(), bits, llvm::MutableArrayRef< T >::data(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcZero, isFiniteNonZero(), llvm::lfExactlyZero, llvm::lostFractionThroughTruncation(), llvm::fltSemantics::minExponent, llvm::APFloatBase::opInexact, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::shiftRight(), llvm::ArrayRef< T >::size(), llvm::APInt::tcAssign(), llvm::APInt::tcExtract(), llvm::APInt::tcIncrement(), llvm::APInt::tcLSB(), llvm::APInt::tcMSB(), llvm::APInt::tcNegate(), llvm::APInt::tcSet(), llvm::APInt::tcSetBit(), and llvm::APInt::tcShiftLeft().
Referenced by llvm::APFloat::convert(), convertToDouble(), llvm::detail::hash_value(), and ~IEEEFloat().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromAPInt | ( | const APInt & | Val, |
bool | isSigned, | ||
roundingMode | rounding_mode | ||
) |
Definition at line 2208 of file APFloat.cpp.
References llvm::APInt::getNumWords(), llvm::APInt::getRawData(), and llvm::APInt::isNegative().
Referenced by roundToIntegral().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromSignExtendedInteger | ( | const integerPart * | src, |
unsigned int | srcCount, | ||
bool | isSigned, | ||
roundingMode | rounding_mode | ||
) |
Definition at line 2226 of file APFloat.cpp.
References llvm::copy(), llvm::APFloatBase::integerPartWidth, llvm::sys::fs::status(), llvm::APInt::tcAssign(), llvm::APInt::tcExtractBit(), and llvm::APInt::tcNegate().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromString | ( | StringRef | str, |
roundingMode | rounding_mode | ||
) |
Definition at line 2573 of file APFloat.cpp.
References assert(), llvm::StringRef::begin(), llvm::StringRef::empty(), llvm::APFloatBase::opOK, and llvm::StringRef::size().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromZeroExtendedInteger | ( | const integerPart * | parts, |
unsigned int | width, | ||
bool | isSigned, | ||
roundingMode | rounding_mode | ||
) |
Definition at line 2252 of file APFloat.cpp.
References assert(), llvm::sys::path::begin(), llvm::StringRef::begin(), D, llvm::decDigitValue(), dot, llvm::sys::path::end(), llvm::StringRef::end(), llvm::StringRef::equals(), llvm::Intrinsic::exp, llvm::decimalInfo::exponent, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::decimalInfo::firstSigDigit, llvm::APInt::getRawData(), llvm::hexDigitValue(), llvm::HUerrBound(), llvm::APFloatBase::integerPartWidth, llvm::interpretDecimal(), llvm::decimalInfo::lastSigDigit, llvm::lfExactlyZero, llvm::lfLessThanHalf, llvm::lostFractionThroughTruncation(), llvm::makeArrayRef(), makeInf(), makeNaN(), makeZero(), llvm::fltSemantics::maxExponent, llvm::maxPowerOfFiveParts, llvm::fltSemantics::minExponent, llvm::decimalInfo::normalizedExponent, llvm::APFloatBase::opOK, llvm::partCountForBits(), llvm::powerOf5(), llvm::fltSemantics::precision, llvm::APFloatBase::rmNearestTiesToAway, llvm::APFloatBase::rmNearestTiesToEven, llvm::skipLeadingZeroesAndAnyDot(), llvm::APInt::tcExtract(), llvm::APInt::tcExtractBit(), llvm::APInt::tcMultiplyPart(), llvm::totalExponent(), llvm::trailingHexadecimalFraction(), llvm::ulpsFromBoundary(), and llvm::APFloatBase::uninitialized.
Referenced by remainder().
double llvm::detail::IEEEFloat::convertToDouble | ( | ) | const |
Definition at line 3024 of file APFloat.cpp.
References add(), assert(), bitcastToAPInt(), llvm::APInt::bitsToDouble(), convert(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::APInt::getBitWidth(), llvm::APInt::getRawData(), isFiniteNonZero(), llvm_unreachable, llvm::APFloatBase::opOK, and llvm::APFloatBase::rmNearestTiesToEven.
float llvm::detail::IEEEFloat::convertToFloat | ( | ) | const |
Definition at line 3017 of file APFloat.cpp.
References assert(), bitcastToAPInt(), and llvm::APInt::bitsToFloat().
unsigned int llvm::detail::IEEEFloat::convertToHexString | ( | char * | dst, |
unsigned int | hexDigits, | ||
bool | upperCase, | ||
roundingMode | rounding_mode | ||
) | 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 2624 of file APFloat.cpp.
References assert(), bits, llvm::count(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::hexDigitsLower, llvm::hexDigitsUpper, llvm::hexDigitValue(), llvm::APFloatBase::integerPartWidth, llvm::lostFractionThroughTruncation(), llvm::Intrinsic::memcpy, llvm::Intrinsic::memset, llvm::partAsHex(), llvm::fltSemantics::precision, and llvm::writeSignedDecimal().
IEEEFloat::opStatus llvm::detail::IEEEFloat::convertToInteger | ( | MutableArrayRef< integerPart > | parts, |
unsigned int | width, | ||
bool | isSigned, | ||
roundingMode | rounding_mode, | ||
bool * | isExact | ||
) | const |
Definition at line 2148 of file APFloat.cpp.
References assert(), bits, llvm::MutableArrayRef< T >::data(), llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::lfExactlyZero, llvm::lostFractionThroughTruncation(), llvm::APFloatBase::opInvalidOp, llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::ArrayRef< T >::size(), llvm::APInt::tcExtract(), llvm::APInt::tcMSB(), llvm::APInt::tcSetLeastSignificantBits(), and llvm::APInt::tcShiftLeft().
Referenced by remainder().
IEEEFloat::opStatus llvm::detail::IEEEFloat::divide | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode | ||
) |
Definition at line 1689 of file APFloat.cpp.
References isFiniteNonZero(), llvm::lfExactlyZero, and llvm::APFloatBase::opInexact.
Referenced by getExactInverse(), and remainder().
IEEEFloat::opStatus llvm::detail::IEEEFloat::fusedMultiplyAdd | ( | const IEEEFloat & | multiplicand, |
const IEEEFloat & | addend, | ||
roundingMode | rounding_mode | ||
) |
Definition at line 1765 of file APFloat.cpp.
References llvm::APFloatBase::fcZero, isFinite(), isFiniteNonZero(), llvm::lfExactlyZero, llvm::APFloatBase::opInexact, llvm::APFloatBase::opOK, llvm::APFloatBase::opUnderflow, and llvm::APFloatBase::rmTowardNegative.
|
inline |
If this value has an exact multiplicative inverse, store it in inv and return true.
Definition at line 3612 of file APFloat.cpp.
References llvm::lltok::APFloat, assert(), divide(), isDenormal(), isFiniteNonZero(), llvm::APFloatBase::opOK, llvm::fltSemantics::precision, and llvm::APFloatBase::rmNearestTiesToEven.
|
inline |
Definition at line 355 of file APFloat.h.
Referenced by llvm::detail::frexp(), 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 760 of file APFloat.cpp.
References llvm::APInt::tcExtractBit().
Referenced by getExactInverse(), llvm::detail::ilogb(), and next().
|
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 331 of file APFloat.h.
Referenced by fusedMultiplyAdd().
|
inline |
Definition at line 357 of file APFloat.h.
References isZero().
Referenced by compareAbsoluteValue(), convert(), convertToDouble(), divide(), fusedMultiplyAdd(), getExactInverse(), llvm::detail::hash_value(), mod(), multiply(), and roundToIntegral().
|
inline |
IEEE-754R isInfinite(): Returns true if and only if the float is infinity.
Definition at line 341 of file APFloat.h.
References llvm::APFloatBase::fcInfinity.
Referenced by llvm::detail::ilogb().
bool llvm::detail::IEEEFloat::isInteger | ( | ) | const |
Returns true if and only if the number is an exact integer.
Definition at line 825 of file APFloat.cpp.
References llvm::ScaledNumbers::compare(), roundToIntegral(), and llvm::truncated.
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 818 of file APFloat.cpp.
Referenced by next().
|
inline |
Returns true if and only if the float is a quiet or signaling NaN.
Definition at line 344 of file APFloat.h.
References llvm::APFloatBase::fcNaN.
Referenced by llvm::detail::hash_value(), llvm::detail::ilogb(), isSignaling(), makeQuiet(), and llvm::detail::scalbn().
|
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 319 of file APFloat.h.
Referenced by next(), roundToIntegral(), and toString().
|
inline |
Definition at line 359 of file APFloat.h.
References Arg, llvm::frexp(), llvm::hash_value(), llvm::detail::ilogb(), initialize(), isZero(), llvm::NVPTX::PTXCvtMode::RM, llvm::scalbn(), llvm::toString(), and X.
|
inline |
Definition at line 356 of file APFloat.h.
References llvm::APFloatBase::fcZero.
Referenced by ~IEEEFloat().
|
inline |
|
inline |
bool llvm::detail::IEEEFloat::isSignaling | ( | ) | const |
Returns true if and only if the float is a signaling NaN.
Definition at line 3641 of file APFloat.cpp.
References isNaN(), llvm::fltSemantics::precision, and llvm::APInt::tcExtractBit().
Referenced by 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 766 of file APFloat.cpp.
References assert(), and llvm::fltSemantics::minExponent.
Referenced by next().
|
inline |
Returns true if and only if the float is plus or minus zero.
Definition at line 334 of file APFloat.h.
References llvm::APFloatBase::fcZero.
Referenced by llvm::detail::ilogb(), mod(), and remainder().
Definition at line 3770 of file APFloat.cpp.
References llvm::APFloatBase::fcInfinity, llvm::fltSemantics::maxExponent, and llvm::APInt::tcSet().
Referenced by convertFromZeroExtendedInteger().
Make this number the largest magnitude normal number in the given semantics.
Definition at line 3250 of file APFloat.cpp.
References llvm::APFloatBase::fcNormal, llvm::APFloatBase::integerPartWidth, llvm::fltSemantics::maxExponent, llvm::Intrinsic::memset, and llvm::fltSemantics::precision.
Referenced by next().
void llvm::detail::IEEEFloat::makeNaN | ( | bool | SNaN = false , |
bool | Neg = false , |
||
const APInt * | fill = nullptr |
||
) |
Definition at line 689 of file APFloat.cpp.
References llvm::APInt::getNumWords(), llvm::APInt::getRawData(), llvm::APInt::tcAssign(), llvm::APInt::tcClearBit(), llvm::APInt::tcIsZero(), llvm::APInt::tcSet(), and llvm::APInt::tcSetBit().
Referenced by compareAbsoluteValue(), convertFromZeroExtendedInteger(), and next().
void llvm::detail::IEEEFloat::makeQuiet | ( | ) |
Definition at line 3784 of file APFloat.cpp.
References assert(), isNaN(), llvm::fltSemantics::precision, and llvm::APInt::tcSetBit().
Referenced by llvm::detail::frexp(), and llvm::detail::scalbn().
Make this number the smallest magnitude denormal number in the given semantics.
Definition at line 3275 of file APFloat.cpp.
References llvm::APFloatBase::fcNormal, llvm::fltSemantics::minExponent, and llvm::APInt::tcSet().
Referenced by next().
Returns the smallest (by magnitude) normalized finite number in the given semantics.
Negative | - True iff the number should be negative |
Definition at line 3286 of file APFloat.cpp.
References llvm::APFloatBase::fcNormal, llvm::APFloatBase::integerPartWidth, llvm::fltSemantics::minExponent, llvm::partCountForBits(), and llvm::fltSemantics::precision.
Definition at line 3777 of file APFloat.cpp.
References llvm::APFloatBase::fcZero, llvm::fltSemantics::minExponent, and llvm::APInt::tcSet().
Referenced by convertFromZeroExtendedInteger().
IEEEFloat::opStatus llvm::detail::IEEEFloat::mod | ( | const IEEEFloat & | rhs | ) |
C fmod, or llvm frem.
Definition at line 1744 of file APFloat.cpp.
References assert(), llvm::APFloatBase::cmpLessThan, compareAbsoluteValue(), ilogb, isFiniteNonZero(), isZero(), llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, scalbn, and subtract().
IEEEFloat::opStatus llvm::detail::IEEEFloat::multiply | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode | ||
) |
Definition at line 1671 of file APFloat.cpp.
References isFiniteNonZero(), llvm::lfExactlyZero, and llvm::APFloatBase::opInexact.
Referenced by remainder().
|
inline |
Returns whether this instance allocated memory.
Definition at line 244 of file APFloat.h.
References llvm::ARM_AM::add, llvm::ScaledNumbers::compare(), llvm::operator==(), and remainder.
IEEEFloat::opStatus llvm::detail::IEEEFloat::next | ( | bool | nextDown | ) |
IEEE-754R 5.3.1: nextUp/nextDown.
IEEE-754R 2008 5.3.1: nextUp/nextDown.
NOTE since nextDown(x) = -nextUp(-x), we only implement nextUp with appropriate sign switching before/after the computation.
Definition at line 3654 of file APFloat.cpp.
References assert(), changeSign(), llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, isDenormal(), isLargest(), isNegative(), isSignaling(), isSmallest(), makeLargest(), makeNaN(), makeSmallest(), llvm::fltSemantics::maxExponent, llvm::fltSemantics::minExponent, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::fltSemantics::precision, llvm::APInt::tcDecrement(), llvm::APInt::tcSet(), and llvm::APInt::tcSetBit().
Definition at line 735 of file APFloat.cpp.
References initialize().
Definition at line 747 of file APFloat.cpp.
References llvm::semBogus.
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.
IEEEFloat::opStatus llvm::detail::IEEEFloat::remainder | ( | const IEEEFloat & | rhs | ) |
IEEE remainder.
Definition at line 1707 of file APFloat.cpp.
References assert(), convertFromZeroExtendedInteger(), convertToInteger(), divide(), llvm::APFloatBase::integerPartWidth, isZero(), llvm::makeMutableArrayRef(), multiply(), llvm::APFloatBase::opDivByZero, llvm::APFloatBase::opInexact, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, and subtract().
IEEEFloat::opStatus llvm::detail::IEEEFloat::roundToIntegral | ( | roundingMode | rounding_mode | ) |
Definition at line 1808 of file APFloat.cpp.
References add(), changeSign(), convertFromAPInt(), isFiniteNonZero(), isNegative(), llvm::NextPowerOf2(), llvm::APFloatBase::opInexact, llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::semanticsPrecision(), and subtract().
Referenced by isInteger().
IEEEFloat::opStatus llvm::detail::IEEEFloat::subtract | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode | ||
) |
Definition at line 1665 of file APFloat.cpp.
Referenced by compareAbsoluteValue(), llvm::detail::hash_value(), mod(), remainder(), and roundToIntegral().
void llvm::detail::IEEEFloat::toString | ( | SmallVectorImpl< char > & | Str, |
unsigned | FormatPrecision = 0 , |
||
unsigned | FormatMaxPadding = 3 , |
||
bool | TruncateZero = true |
||
) | const |
Converts this value into a decimal string.
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. |
TruncateZero | Indicate whether to remove the trailing zero in fraction part or not. Also setting this parameter to false forcing producing of output more similar to default printf behavior. Specifically the lower e is used as exponent delimiter and exponent always contains no less than two digits. |
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 3396 of file APFloat.cpp.
References llvm::sys::path::append(), llvm::SmallVectorImpl< T >::append(), assert(), llvm::APInt::countTrailingZeros(), E, llvm::SmallVectorBase::empty(), llvm::Intrinsic::exp, llvm::APFloatBase::fcInfinity, llvm::APFloatBase::fcNaN, llvm::APFloatBase::fcNormal, llvm::APFloatBase::fcZero, llvm::APInt::getBitWidth(), llvm::APInt::getZExtValue(), I, isNegative(), llvm::APInt::lshrInPlace(), llvm::makeArrayRef(), llvm::partCountForBits(), llvm::fltSemantics::precision, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), llvm::SmallVectorBase::size(), llvm::APInt::udivrem(), and llvm::APInt::zext().
|
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 2773 of file APFloat.cpp.
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 3789 of file APFloat.cpp.
Referenced by llvm::detail::frexp(), and mod().
|
friend |
Returns: X * 2^Exp for integral exponents.
Referenced by llvm::detail::frexp(), and mod().