LLVM 22.0.0git
|
#include "llvm/ADT/APFloat.h"
Public Member Functions | |
bool | needsCleanup () const |
Returns whether this instance allocated memory. | |
bool | operator== (const IEEEFloat &) const =delete |
The definition of equality is not straightforward for floating point, so we won't use operator==. | |
LLVM_ABI cmpResult | compare (const IEEEFloat &) const |
IEEE comparison with another floating point number (NaNs compare unordered, 0==-0). | |
LLVM_ABI bool | bitwiseIsEqual (const IEEEFloat &) const |
Bitwise comparison for equality (QNaNs compare equal, 0!=-0). | |
LLVM_ABI 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. | |
LLVM_ABI IEEEFloat & | operator= (const IEEEFloat &) |
LLVM_ABI IEEEFloat & | operator= (IEEEFloat &&) |
LLVM_ABI void | toString (SmallVectorImpl< char > &Str, unsigned FormatPrecision=0, unsigned FormatMaxPadding=3, bool TruncateZero=true) const |
Converts this value into a decimal string. | |
LLVM_ABI LLVM_READONLY int | getExactLog2Abs () const |
LLVM_ABI cmpResult | compareAbsoluteValue (const IEEEFloat &) const |
Constructors | |
LLVM_ABI | IEEEFloat (const fltSemantics &) |
LLVM_ABI | IEEEFloat (const fltSemantics &, integerPart) |
LLVM_ABI | IEEEFloat (const fltSemantics &, uninitializedTag) |
LLVM_ABI | IEEEFloat (const fltSemantics &, const APInt &) |
LLVM_ABI | IEEEFloat (double d) |
LLVM_ABI | IEEEFloat (float f) |
LLVM_ABI | IEEEFloat (const IEEEFloat &) |
LLVM_ABI | IEEEFloat (IEEEFloat &&) |
LLVM_ABI | ~IEEEFloat () |
Arithmetic | |
LLVM_ABI opStatus | add (const IEEEFloat &, roundingMode) |
LLVM_ABI opStatus | subtract (const IEEEFloat &, roundingMode) |
LLVM_ABI opStatus | multiply (const IEEEFloat &, roundingMode) |
LLVM_ABI opStatus | divide (const IEEEFloat &, roundingMode) |
LLVM_ABI opStatus | remainder (const IEEEFloat &) |
IEEE remainder. | |
LLVM_ABI opStatus | mod (const IEEEFloat &) |
C fmod, or llvm frem. | |
LLVM_ABI opStatus | fusedMultiplyAdd (const IEEEFloat &, const IEEEFloat &, roundingMode) |
LLVM_ABI opStatus | roundToIntegral (roundingMode) |
LLVM_ABI opStatus | next (bool nextDown) |
IEEE-754R 5.3.1: nextUp/nextDown. | |
Sign operations. | |
LLVM_ABI void | changeSign () |
Conversions | |
LLVM_ABI opStatus | convert (const fltSemantics &, roundingMode, bool *) |
IEEEFloat::convert - convert a value of one floating point type to another. | |
LLVM_ABI opStatus | convertToInteger (MutableArrayRef< integerPart >, unsigned int, bool, roundingMode, bool *) const |
LLVM_ABI opStatus | convertFromAPInt (const APInt &, bool, roundingMode) |
LLVM_ABI Expected< opStatus > | convertFromString (StringRef, roundingMode) |
LLVM_ABI APInt | bitcastToAPInt () const |
LLVM_ABI double | convertToDouble () const |
LLVM_ABI 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. | |
bool | isNormal () const |
IEEE-754R isNormal: Returns true if and only if the current value is normal. | |
bool | isFinite () const |
Returns true if and only if the current value is zero, subnormal, or normal. | |
bool | isZero () const |
Returns true if and only if the float is plus or minus zero. | |
LLVM_ABI bool | isDenormal () const |
IEEE-754R isSubnormal(): Returns true if and only if the float is a denormal. | |
bool | isInfinity () const |
IEEE-754R isInfinite(): Returns true if and only if the float is infinity. | |
bool | isNaN () const |
Returns true if and only if the float is a quiet or signaling NaN. | |
LLVM_ABI bool | isSignaling () const |
Returns true if and only if the float is a signaling NaN. | |
Special value setters. | |
LLVM_ABI void | makeLargest (bool Neg=false) |
Make this number the largest magnitude normal number in the given semantics. | |
LLVM_ABI void | makeSmallest (bool Neg=false) |
Make this number the smallest magnitude denormal number in the given semantics. | |
LLVM_ABI void | makeNaN (bool SNaN=false, bool Neg=false, const APInt *fill=nullptr) |
LLVM_ABI void | makeInf (bool Neg=false) |
LLVM_ABI void | makeZero (bool Neg=false) |
LLVM_ABI void | makeQuiet () |
LLVM_ABI void | makeSmallestNormalized (bool Negative=false) |
Returns the smallest (by magnitude) normalized finite number in the given semantics. |
Friends | |
class | IEEEFloatUnitTestHelper |
LLVM_ABI friend hash_code | hash_value (const IEEEFloat &Arg) |
Overload to compute a hash code for an APFloat value. | |
LLVM_ABI friend int | ilogb (const IEEEFloat &Arg) |
LLVM_ABI friend IEEEFloat | scalbn (IEEEFloat X, int Exp, roundingMode RoundingMode) |
LLVM_ABI friend IEEEFloat | frexp (const IEEEFloat &X, int &Exp, roundingMode RM) |
Simple Queries | |
fltCategory | getCategory () const |
const fltSemantics & | getSemantics () const |
bool | isNonZero () const |
bool | isFiniteNonZero () const |
bool | isPosZero () const |
bool | isNegZero () const |
LLVM_ABI bool | isSmallest () const |
Returns true if and only if the number has the smallest possible non-zero magnitude in the current semantics. | |
LLVM_ABI bool | isSmallestNormalized () const |
Returns true if this is the smallest (by magnitude) normalized finite number in the given semantics. | |
LLVM_ABI bool | isLargest () const |
Returns true if and only if the number has the largest possible finite magnitude in the current semantics. | |
LLVM_ABI bool | isInteger () const |
Returns true if and only if the number is an exact integer. |
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics | ) |
Definition at line 1229 of file APFloat.cpp.
References llvm::fltSemantics::hasZero, makeSmallestNormalized(), and makeZero().
Referenced by add(), bitwiseIsEqual(), compare(), compareAbsoluteValue(), divide(), frexp, fusedMultiplyAdd(), hash_value, IEEEFloat(), IEEEFloat(), IEEEFloat(), IEEEFloat(), IEEEFloat(), IEEEFloat(), ilogb, isInteger(), mod(), multiply(), operator=(), operator=(), operator==(), remainder(), roundToIntegral(), scalbn, and subtract().
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics, |
integerPart | value ) |
Definition at line 1219 of file APFloat.cpp.
References llvm::detail::fcNormal, llvm::lfExactlyZero, llvm::fltSemantics::precision, llvm::detail::rmNearestTiesToEven, and llvm::detail::unit< Period >::value.
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | ourSemantics, |
uninitializedTag | tag ) |
Definition at line 1242 of file APFloat.cpp.
References IEEEFloat().
llvm::detail::IEEEFloat::IEEEFloat | ( | const fltSemantics & | Sem, |
const APInt & | API ) |
Definition at line 4200 of file APFloat.cpp.
References IEEEFloat().
|
explicit |
Definition at line 4208 of file APFloat.cpp.
References llvm::APInt::doubleToBits(), IEEEFloat(), and llvm::semIEEEdouble.
|
explicit |
Definition at line 4204 of file APFloat.cpp.
References llvm::APInt::floatToBits(), IEEEFloat(), and llvm::semIEEEsingle.
Definition at line 1245 of file APFloat.cpp.
References IEEEFloat().
llvm::detail::IEEEFloat::IEEEFloat | ( | IEEEFloat && | rhs | ) |
Definition at line 1250 of file APFloat.cpp.
References IEEEFloat(), and llvm::semBogus.
llvm::detail::IEEEFloat::~IEEEFloat | ( | ) |
Definition at line 1254 of file APFloat.cpp.
APFloat::opStatus llvm::detail::IEEEFloat::add | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode ) |
Definition at line 2184 of file APFloat.cpp.
References IEEEFloat().
Referenced by remainder(), and roundToIntegral().
APInt llvm::detail::IEEEFloat::bitcastToAPInt | ( | ) | const |
Definition at line 3767 of file APFloat.cpp.
References assert(), llvm::semBFloat, llvm::semFloat4E2M1FN, llvm::semFloat6E2M3FN, llvm::semFloat6E3M2FN, llvm::semFloat8E3M4, llvm::semFloat8E4M3, llvm::semFloat8E4M3B11FNUZ, llvm::semFloat8E4M3FN, llvm::semFloat8E4M3FNUZ, llvm::semFloat8E5M2, llvm::semFloat8E5M2FNUZ, llvm::semFloat8E8M0FNU, llvm::semFloatTF32, llvm::semIEEEdouble, llvm::semIEEEhalf, llvm::semIEEEquad, llvm::semIEEEsingle, llvm::semPPCDoubleDoubleLegacy, and llvm::semX87DoubleExtended.
Referenced by convertToDouble(), and convertToFloat().
Bitwise comparison for equality (QNaNs compare equal, 0!=-0).
Definition at line 1202 of file APFloat.cpp.
References llvm::detail::fcInfinity, llvm::detail::fcZero, IEEEFloat(), and isFiniteNonZero().
void llvm::detail::IEEEFloat::changeSign | ( | ) |
Definition at line 2140 of file APFloat.cpp.
References isNaN(), isZero(), and llvm::NegativeZero.
Referenced by next(), and roundToIntegral().
APFloat::cmpResult llvm::detail::IEEEFloat::compare | ( | const IEEEFloat & | rhs | ) | const |
IEEE comparison with another floating point number (NaNs compare unordered, 0==-0).
Definition at line 2517 of file APFloat.cpp.
References assert(), llvm::detail::cmpEqual, llvm::detail::cmpGreaterThan, llvm::detail::cmpLessThan, llvm::detail::cmpUnordered, compareAbsoluteValue(), llvm::detail::fcInfinity, llvm::detail::fcNaN, llvm::detail::fcNormal, llvm::detail::fcZero, IEEEFloat(), llvm_unreachable, and PackCategoriesIntoKey.
Referenced by compareAbsoluteValue(), isInteger(), and remainder().
APFloat::cmpResult llvm::detail::IEEEFloat::compareAbsoluteValue | ( | const IEEEFloat & | rhs | ) | const |
Definition at line 1575 of file APFloat.cpp.
References assert(), llvm::detail::cmpEqual, llvm::detail::cmpGreaterThan, llvm::detail::cmpLessThan, compare(), IEEEFloat(), isFiniteNonZero(), and llvm::APInt::tcCompare().
APFloat::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 2594 of file APFloat.cpp.
References llvm::detail::fcInfinity, llvm::detail::fcNaN, llvm::detail::fcZero, isFiniteNonZero(), isSignaling(), llvm::lfExactlyZero, makeNaN(), makeQuiet(), makeSmallestNormalized(), llvm::fltSemantics::minExponent, llvm::fltSemantics::nanEncoding, llvm::NanOnly, llvm::NegativeZero, llvm::fltSemantics::nonFiniteBehavior, llvm::detail::opInexact, llvm::detail::opInvalidOp, llvm::detail::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 remainder().
APFloat::opStatus llvm::detail::IEEEFloat::convertFromAPInt | ( | const APInt & | Val, |
bool | isSigned, | ||
roundingMode | rounding_mode ) |
Definition at line 2916 of file APFloat.cpp.
References llvm::APInt::getNumWords(), llvm::APInt::getRawData(), llvm::APInt::isNegative(), and isSigned().
Referenced by roundToIntegral().
Expected< APFloat::opStatus > llvm::detail::IEEEFloat::convertFromString | ( | StringRef | str, |
roundingMode | rounding_mode ) |
Definition at line 3302 of file APFloat.cpp.
References llvm::StringRef::begin(), llvm::createError(), llvm::StringRef::empty(), llvm_unreachable, llvm::detail::opOK, and llvm::StringRef::size().
double llvm::detail::IEEEFloat::convertToDouble | ( | ) | const |
Definition at line 3834 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 3827 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 | 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 3359 of file APFloat.cpp.
References llvm::detail::fcInfinity, llvm::detail::fcNaN, llvm::detail::fcNormal, llvm::detail::fcZero, llvm::infinityL, llvm::infinityU, llvm::NaNL, and llvm::NaNU.
APFloat::opStatus llvm::detail::IEEEFloat::convertToInteger | ( | MutableArrayRef< integerPart > | parts, |
unsigned int | width, | ||
bool | isSigned, | ||
roundingMode | rounding_mode, | ||
bool * | isExact ) const |
Definition at line 2856 of file APFloat.cpp.
References assert(), llvm::MutableArrayRef< T >::data(), llvm::detail::fcNaN, isSigned(), llvm::detail::opInvalidOp, llvm::partCountForBits(), llvm::ArrayRef< T >::size(), llvm::detail::tcSetLeastSignificantBits(), and llvm::APInt::tcShiftLeft().
APFloat::opStatus llvm::detail::IEEEFloat::divide | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode ) |
Definition at line 2216 of file APFloat.cpp.
References IEEEFloat(), isFiniteNonZero(), isZero(), llvm::lfExactlyZero, llvm::NegativeZero, and llvm::detail::opInexact.
APFloat::opStatus llvm::detail::IEEEFloat::fusedMultiplyAdd | ( | const IEEEFloat & | multiplicand, |
const IEEEFloat & | addend, | ||
roundingMode | rounding_mode ) |
Definition at line 2384 of file APFloat.cpp.
References llvm::detail::fcZero, IEEEFloat(), isFinite(), isFiniteNonZero(), llvm::lfExactlyZero, llvm::NegativeZero, llvm::detail::opInexact, llvm::detail::opOK, llvm::detail::opUnderflow, and llvm::detail::rmTowardNegative.
|
inline |
Definition at line 533 of file APFloat.h.
Referenced by isSmallestNormalized().
int llvm::detail::IEEEFloat::getExactLog2Abs | ( | ) | const |
Definition at line 4533 of file APFloat.cpp.
References llvm::APInt::APINT_BITS_PER_WORD, llvm::countr_zero(), getExactLog2Abs(), llvm::isFinite(), isZero(), llvm_unreachable, llvm::partCountForBits(), and llvm::popcount().
Referenced by getExactLog2Abs().
|
inline |
bool llvm::detail::IEEEFloat::isDenormal | ( | ) | const |
IEEE-754R isSubnormal(): Returns true if and only if the float is a denormal.
Definition at line 1061 of file APFloat.cpp.
References isFiniteNonZero(), and llvm::APInt::tcExtractBit().
Referenced by ilogb, 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 510 of file APFloat.h.
References isInfinity(), and isNaN().
Referenced by fusedMultiplyAdd(), isFiniteNonZero(), and isInteger().
|
inline |
Definition at line 536 of file APFloat.h.
References isFinite(), and isZero().
Referenced by bitwiseIsEqual(), compareAbsoluteValue(), convert(), divide(), fusedMultiplyAdd(), hash_value, isDenormal(), isLargest(), isNormal(), isSmallest(), mod(), and multiply().
|
inline |
IEEE-754R isInfinite(): Returns true if and only if the float is infinity.
Definition at line 520 of file APFloat.h.
References llvm::detail::fcInfinity.
Referenced by ilogb, isFinite(), and roundToIntegral().
bool llvm::detail::IEEEFloat::isInteger | ( | ) | const |
Returns true if and only if the number is an exact integer.
Definition at line 1194 of file APFloat.cpp.
References llvm::detail::cmpEqual, compare(), IEEEFloat(), isFinite(), llvm::detail::rmTowardZero, 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 1177 of file APFloat.cpp.
References llvm::AllOnes, llvm::APFloat::hasSignificand(), isFiniteNonZero(), and llvm::NanOnly.
Referenced by next().
|
inline |
Returns true if and only if the float is a quiet or signaling NaN.
Definition at line 523 of file APFloat.h.
References llvm::detail::fcNaN.
Referenced by changeSign(), hash_value, ilogb, isFinite(), isSignaling(), makeQuiet(), and roundToIntegral().
|
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 498 of file APFloat.h.
Referenced by isNegZero(), isPosZero(), next(), roundToIntegral(), and toString().
|
inline |
Definition at line 538 of file APFloat.h.
References isNegative(), and isZero().
|
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 504 of file APFloat.h.
References isDenormal(), and isFiniteNonZero().
|
inline |
Definition at line 537 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 4562 of file APFloat.cpp.
References llvm::FiniteOnly, isNaN(), isSignaling(), llvm::NanOnly, and llvm::APInt::tcExtractBit().
Referenced by convert(), isSignaling(), next(), and roundToIntegral().
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 1067 of file APFloat.cpp.
References isFiniteNonZero().
Referenced by next().
bool llvm::detail::IEEEFloat::isSmallestNormalized | ( | ) | const |
Returns true if this is the smallest (by magnitude) normalized finite number in the given semantics.
Definition at line 1075 of file APFloat.cpp.
References llvm::detail::fcNormal, and getCategory().
|
inline |
Returns true if and only if the float is plus or minus zero.
Definition at line 513 of file APFloat.h.
Referenced by changeSign(), divide(), ilogb, isFiniteNonZero(), isNegZero(), isPosZero(), mod(), multiply(), remainder(), and roundToIntegral().
void llvm::detail::IEEEFloat::makeInf | ( | bool | Neg = false | ) |
Definition at line 4723 of file APFloat.cpp.
References llvm::exponentInf(), llvm::detail::fcInfinity, llvm::FiniteOnly, llvm_unreachable, makeInf(), makeNaN(), llvm::NanOnly, and llvm::APInt::tcSet().
Referenced by makeInf().
void llvm::detail::IEEEFloat::makeLargest | ( | bool | Neg = false | ) |
Make this number the largest magnitude normal number in the given semantics.
Definition at line 4138 of file APFloat.cpp.
References llvm::AllOnes, llvm::detail::fcNormal, llvm::detail::integerPartWidth, llvm_unreachable, makeLargest(), and llvm::NanOnly.
Referenced by makeLargest(), and next().
void llvm::detail::IEEEFloat::makeNaN | ( | bool | SNaN = false, |
bool | Neg = false, | ||
const APInt * | fill = nullptr ) |
Definition at line 964 of file APFloat.cpp.
References llvm::detail::fcNaN, llvm::fill(), llvm::FiniteOnly, llvm::APInt::getAllOnes(), llvm::APInt::getZero(), llvm_unreachable, llvm::NanOnly, llvm::NegativeZero, llvm::semX87DoubleExtended, llvm::APInt::tcAssign(), llvm::APInt::tcClearBit(), llvm::APInt::tcIsZero(), llvm::APInt::tcSet(), and llvm::APInt::tcSetBit().
void llvm::detail::IEEEFloat::makeQuiet | ( | ) |
Definition at line 4752 of file APFloat.cpp.
References assert(), isNaN(), makeQuiet(), llvm::NanOnly, and llvm::APInt::tcSetBit().
Referenced by convert(), makeQuiet(), and roundToIntegral().
void llvm::detail::IEEEFloat::makeSmallest | ( | bool | Neg = false | ) |
Make this number the smallest magnitude denormal number in the given semantics.
Definition at line 4170 of file APFloat.cpp.
References llvm::detail::fcNormal, llvm_unreachable, makeSmallest(), and llvm::APInt::tcSet().
Referenced by makeSmallest(), and next().
void llvm::detail::IEEEFloat::makeSmallestNormalized | ( | bool | Negative = false | ) |
Returns the smallest (by magnitude) normalized finite number in the given semantics.
Negative | - True iff the number should be negative |
Definition at line 4184 of file APFloat.cpp.
References llvm::detail::fcNormal, llvm_unreachable, makeSmallestNormalized(), and llvm::APInt::tcSetBit().
Referenced by convert(), IEEEFloat(), makeSmallestNormalized(), and next().
void llvm::detail::IEEEFloat::makeZero | ( | bool | Neg = false | ) |
Definition at line 4738 of file APFloat.cpp.
References llvm::exponentZero(), llvm::detail::fcZero, llvm_unreachable, makeZero(), llvm::NegativeZero, and llvm::APInt::tcSet().
Referenced by IEEEFloat(), and makeZero().
APFloat::opStatus llvm::detail::IEEEFloat::mod | ( | const IEEEFloat & | rhs | ) |
C fmod, or llvm frem.
Definition at line 2346 of file APFloat.cpp.
References assert(), llvm::detail::cmpLessThan, compareAbsoluteValue(), IEEEFloat(), ilogb, isFiniteNonZero(), isZero(), llvm::NegativeZero, llvm::detail::opOK, llvm::detail::rmNearestTiesToEven, scalbn, and subtract().
Referenced by remainder().
APFloat::opStatus llvm::detail::IEEEFloat::multiply | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode ) |
Definition at line 2196 of file APFloat.cpp.
References IEEEFloat(), isFiniteNonZero(), isZero(), llvm::lfExactlyZero, llvm::NegativeZero, and llvm::detail::opInexact.
|
inline |
APFloat::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 4578 of file APFloat.cpp.
References assert(), changeSign(), llvm::detail::fcInfinity, llvm::detail::fcNaN, llvm::detail::fcNormal, llvm::detail::fcZero, llvm::FiniteOnly, llvm::APFloat::hasSignificand(), isDenormal(), isLargest(), isNegative(), isSignaling(), isSmallest(), makeLargest(), makeNaN(), makeSmallest(), makeSmallestNormalized(), llvm::NanOnly, llvm::NegativeZero, next(), llvm::detail::opInvalidOp, llvm::detail::opOK, llvm::APInt::tcDecrement(), llvm::APInt::tcSet(), and llvm::APInt::tcSetBit().
Referenced by next().
Definition at line 1036 of file APFloat.cpp.
References IEEEFloat().
Definition at line 1048 of file APFloat.cpp.
References IEEEFloat(), and 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.
References IEEEFloat(), and LLVM_ABI.
APFloat::opStatus llvm::detail::IEEEFloat::remainder | ( | const IEEEFloat & | rhs | ) |
IEEE remainder.
Definition at line 2236 of file APFloat.cpp.
References add(), assert(), llvm::detail::cmpEqual, llvm::detail::cmpGreaterThan, compare(), convert(), IEEEFloat(), isZero(), llvm::fltSemantics::maxExponent, llvm::fltSemantics::minExponent, mod(), llvm::NegativeZero, llvm::detail::opDivByZero, llvm::detail::opOK, P, llvm::fltSemantics::precision, llvm::detail::rmNearestTiesToEven, and subtract().
APFloat::opStatus llvm::detail::IEEEFloat::roundToIntegral | ( | roundingMode | rounding_mode | ) |
Definition at line 2430 of file APFloat.cpp.
References add(), assert(), changeSign(), convertFromAPInt(), IEEEFloat(), isInfinity(), isNaN(), isNegative(), isSignaling(), isZero(), makeQuiet(), llvm::NextPowerOf2(), llvm::detail::opInvalidOp, llvm::detail::opOK, llvm::detail::rmNearestTiesToEven, llvm::APFloatBase::semanticsPrecision(), and subtract().
APFloat::opStatus llvm::detail::IEEEFloat::subtract | ( | const IEEEFloat & | rhs, |
roundingMode | rounding_mode ) |
Definition at line 2190 of file APFloat.cpp.
References IEEEFloat().
Referenced by 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 4489 of file APFloat.cpp.
References llvm::detail::fcInfinity, llvm::detail::fcNaN, llvm::detail::fcNormal, llvm::detail::fcZero, isNegative(), llvm::partCountForBits(), and toString().
Referenced by toString().
|
friend |
Definition at line 4797 of file APFloat.cpp.
References IEEEFloat(), llvm::APFloatBase::IEK_Inf, llvm::APFloatBase::IEK_NaN, llvm::APFloatBase::IEK_Zero, llvm::ilogb(), llvm::Quiet, and llvm::scalbn().
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 3508 of file APFloat.cpp.
References llvm::hash_combine(), llvm::hash_combine_range(), IEEEFloat(), isFiniteNonZero(), isNaN(), and llvm::fltSemantics::precision.
|
friend |
Definition at line 776 of file APFloat.h.
References IEEEFloatUnitTestHelper.
Referenced by IEEEFloatUnitTestHelper.
Definition at line 4758 of file APFloat.cpp.
References getSemantics(), IEEEFloat(), llvm::APFloatBase::IEK_Inf, llvm::APFloatBase::IEK_NaN, llvm::APFloatBase::IEK_Zero, isDenormal(), isInfinity(), isNaN(), isZero(), llvm::lfExactlyZero, llvm::fltSemantics::precision, and llvm::APFloatBase::rmNearestTiesToEven.
Referenced by mod().
|
friend |
Definition at line 4776 of file APFloat.cpp.
References IEEEFloat(), llvm::lfExactlyZero, and X.
Referenced by mod().