|
LLVM
4.0.0
|
#include <APFloat.h>
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... | |
| IEEEFloat & | operator= (const IEEEFloat &) |
| IEEEFloat & | operator= (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 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 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 () |
| static const fltSemantics & | IEEEsingle () |
| static const fltSemantics & | IEEEdouble () |
| static const fltSemantics & | IEEEquad () |
| static const fltSemantics & | PPCDoubleDouble () |
| static const fltSemantics & | x87DoubleExtended () |
| static const fltSemantics & | Bogus () |
| A Pseudo fltsemantic used to construct APFloats that cannot conflict with anything real. More... | |
| 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 | ||
| ) |
Definition at line 833 of file APFloat.cpp.
References llvm::APFloatBase::fcNormal, llvm::lfExactlyZero, llvm::fltSemantics::precision, and llvm::APFloatBase::rmNearestTiesToEven.
| 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.
|
explicit |
Definition at line 3333 of file APFloat.cpp.
References llvm::APInt::doubleToBits(), and llvm::semIEEEdouble.
|
explicit |
Definition at line 3329 of file APFloat.cpp.
References llvm::APInt::floatToBits(), and llvm::semIEEEsingle.
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.
| 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 |
Definition at line 3023 of file APFloat.cpp.
References assert(), llvm::semIEEEdouble, llvm::semIEEEhalf, llvm::semIEEEquad, llvm::semIEEEsingle, llvm::semPPCDoubleDoubleImpl, and llvm::semX87DoubleExtended.
Referenced by llvm::APFloat::bitcastToAPInt(), convertToDouble(), convertToFloat(), and Profile().
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 |
IEEE comparison with another floating point number (NaNs compare unordered, 0==-0).
Definition at line 1866 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 llvm::APFloat::compare(), compareAbsoluteValue(), and isInteger().
| IEEEFloat::cmpResult llvm::detail::IEEEFloat::compareAbsoluteValue | ( | const IEEEFloat & | rhs | ) | const |
Definition at line 1175 of file APFloat.cpp.
References assert(), llvm::APFloatBase::cmpEqual, llvm::APFloatBase::cmpGreaterThan, llvm::APFloatBase::cmpLessThan, compare(), isFiniteNonZero(), and llvm::APInt::tcCompare().
Referenced by compare().
| 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 | |||
| ) |
Definition at line 2235 of file APFloat.cpp.
References llvm::APInt::getNumWords(), llvm::APInt::getRawData(), and llvm::APInt::isNegative().
Referenced by llvm::APFloat::convertFromAPInt(), and roundToIntegral().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromSignExtendedInteger | ( | const integerPart * | , |
| unsigned int | , | ||
| bool | , | ||
| roundingMode | |||
| ) |
Definition at line 2253 of file APFloat.cpp.
References llvm::integerPartWidth, llvm::sys::fs::status(), llvm::APInt::tcAssign(), llvm::APInt::tcExtractBit(), and llvm::APInt::tcNegate().
Referenced by llvm::APFloat::convertFromSignExtendedInteger().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromString | ( | StringRef | , |
| roundingMode | |||
| ) |
Definition at line 2600 of file APFloat.cpp.
References assert(), llvm::StringRef::begin(), llvm::StringRef::empty(), llvm::APFloatBase::opOK, and llvm::StringRef::size().
Referenced by llvm::APFloat::convertFromString().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::convertFromZeroExtendedInteger | ( | const integerPart * | , |
| unsigned int | , | ||
| bool | , | ||
| roundingMode | |||
| ) |
Definition at line 2279 of file APFloat.cpp.
References llvm::APInt::getRawData(), llvm::makeArrayRef(), llvm::partCountForBits(), and llvm::APInt::tcExtractBit().
Referenced by llvm::APFloat::convertFromZeroExtendedInteger(), mod(), and remainder().
| double llvm::detail::IEEEFloat::convertToDouble | ( | ) | const |
Definition at line 3051 of file APFloat.cpp.
References assert(), bitcastToAPInt(), llvm::APInt::bitsToDouble(), and llvm::semIEEEdouble.
Referenced by llvm::APFloat::convertToDouble().
| float llvm::detail::IEEEFloat::convertToFloat | ( | ) | const |
Definition at line 3044 of file APFloat.cpp.
References assert(), bitcastToAPInt(), llvm::APInt::bitsToFloat(), and llvm::semIEEEsingle.
Referenced by llvm::APFloat::convertToFloat().
| 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 |
Referenced by llvm::APFloat::convertToInteger(), mod(), and remainder().
| opStatus llvm::detail::IEEEFloat::convertToInteger | ( | APSInt & | , |
| roundingMode | , | ||
| bool * | |||
| ) | const |
Definition at line 1619 of file APFloat.cpp.
Referenced by copySign(), llvm::APFloat::copySign(), and roundToIntegral().
|
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 | |||
| ) |
Definition at line 1685 of file APFloat.cpp.
References isFiniteNonZero(), llvm::lfExactlyZero, and llvm::APFloatBase::opInexact.
Referenced by llvm::APFloat::divide(), getExactInverse(), mod(), operator/(), and remainder().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::fusedMultiplyAdd | ( | const IEEEFloat & | , |
| const IEEEFloat & | , | ||
| roundingMode | |||
| ) |
Definition at line 1780 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.
Referenced by llvm::APFloat::fusedMultiplyAdd().
|
inline |
Definition at line 387 of file APFloat.h.
Referenced by llvm::APFloat::getCategory().
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().
|
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().
|
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().
|
inline |
Definition at line 390 of file APFloat.h.
References isFinite(), and isZero().
Referenced by bitwiseIsEqual(), compareAbsoluteValue(), convert(), divide(), fusedMultiplyAdd(), getExactInverse(), llvm::detail::hash_value(), isDenormal(), isLargest(), isNormal(), isSmallest(), mod(), multiply(), and roundToIntegral().
|
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().
|
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().
|
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().
|
inline |
Definition at line 392 of file APFloat.h.
References isNegative(), and isZero().
|
inline |
Definition at line 389 of file APFloat.h.
References llvm::APFloatBase::fcZero.
|
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().
|
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().
|
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().
Definition at line 3781 of file APFloat.cpp.
References llvm::APFloatBase::fcInfinity, llvm::fltSemantics::maxExponent, and llvm::APInt::tcSet().
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 |
||
| ) |
Definition at line 672 of file APFloat.cpp.
References llvm::APFloatBase::fcNaN, llvm::APInt::getNumWords(), llvm::APInt::getRawData(), fuzzer::min(), llvm::fltSemantics::precision, llvm::semX87DoubleExtended, llvm::APInt::tcAssign(), llvm::APInt::tcClearBit(), llvm::APInt::tcIsZero(), llvm::APInt::tcSet(), and llvm::APInt::tcSetBit().
Referenced by next().
| void llvm::detail::IEEEFloat::makeQuiet | ( | ) |
Definition at line 3795 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 3300 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 3311 of file APFloat.cpp.
References llvm::APFloatBase::fcNormal, llvm::fltSemantics::minExponent, llvm::partCountForBits(), and llvm::fltSemantics::precision.
Definition at line 3788 of file APFloat.cpp.
References llvm::APFloatBase::fcZero, llvm::fltSemantics::minExponent, and llvm::APInt::tcSet().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::mod | ( | const IEEEFloat & | rhs | ) |
C fmod, or llvm frem.
Definition at line 1740 of file APFloat.cpp.
References assert(), convertFromZeroExtendedInteger(), convertToInteger(), divide(), llvm::integerPartWidth, isFiniteNonZero(), isZero(), multiply(), llvm::APFloatBase::opDivByZero, llvm::APFloatBase::opInexact, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::rmTowardZero, and subtract().
Referenced by llvm::APFloat::mod().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::multiply | ( | const IEEEFloat & | , |
| roundingMode | |||
| ) |
Definition at line 1667 of file APFloat.cpp.
References isFiniteNonZero(), llvm::lfExactlyZero, and llvm::APFloatBase::opInexact.
Referenced by mod(), llvm::APFloat::multiply(), operator*(), and remainder().
|
inline |
| 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 3665 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().
Referenced by llvm::APFloat::next().
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.
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.
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().
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.
Definition at line 718 of file APFloat.cpp.
Definition at line 730 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.
| 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 | ) |
IEEE remainder.
Definition at line 1703 of file APFloat.cpp.
References assert(), convertFromZeroExtendedInteger(), convertToInteger(), divide(), llvm::integerPartWidth, isZero(), multiply(), llvm::APFloatBase::opDivByZero, llvm::APFloatBase::opInexact, llvm::APFloatBase::opInvalidOp, llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, and subtract().
Referenced by llvm::APFloat::remainder().
| IEEEFloat::opStatus llvm::detail::IEEEFloat::roundToIntegral | ( | roundingMode | ) |
Definition at line 1823 of file APFloat.cpp.
References add(), changeSign(), convertFromAPInt(), copySign(), isFiniteNonZero(), isNegative(), llvm::NextPowerOf2(), llvm::APFloatBase::opInexact, llvm::APFloatBase::opOK, llvm::APFloatBase::rmNearestTiesToEven, llvm::APFloatBase::semanticsPrecision(), and subtract().
Referenced by isInteger(), and llvm::APFloat::roundToIntegral().
| 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.
| 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
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().
|
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.
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.
|
friend |
Returns: X * 2^Exp for integral exponents.
1.8.6