float16_t float16_t::remainder(float16_t denominator) const { llvm::APFloat result = toLLVMAPF(*this); llvm::APFloat rhsAPF = toLLVMAPF(denominator); // FIXME: Ignoring possible exceptions result.remainder(rhsAPF); return toFP16(result); }
float16_t float16_t::multiply(float16_t rhs, RoundingMode roundingMode) const { llvm::APFloat result = toLLVMAPF(*this); llvm::APFloat rhsAPF = toLLVMAPF(rhs); // FIXME: Ignoring possible exceptions result.multiply(rhsAPF, getLLVMAPFRoundingMode(roundingMode)); return toFP16(result); }
float16_t float16_t::divide(float16_t denominator, RoundingMode roundingMode) const { llvm::APFloat result = toLLVMAPF(*this); llvm::APFloat rhsAPF = toLLVMAPF(denominator); // FIXME: Ignoring possible exceptions result.divide(rhsAPF, getLLVMAPFRoundingMode(roundingMode)); return toFP16(result); }
float16_t float16_t::make_nan() { #if LLVM_VERSION >= 40 llvm::APFloat nan = llvm::APFloat::getNaN(llvm::APFloat::IEEEhalf()); #else llvm::APFloat nan = llvm::APFloat::getNaN(llvm::APFloat::IEEEhalf); #endif return toFP16(nan); }
float16_t float16_t::make_infinity(bool positive) { #if LLVM_VERSION >= 40 llvm::APFloat inf = llvm::APFloat::getInf(llvm::APFloat::IEEEhalf(), !positive); #else llvm::APFloat inf = llvm::APFloat::getInf(llvm::APFloat::IEEEhalf, !positive); #endif return toFP16(inf); }
float16_t float16_t::make_zero(bool positive) { #if LLVM_VERSION >= 40 llvm::APFloat zero = llvm::APFloat::getZero(llvm::APFloat::IEEEhalf(), !positive); #else llvm::APFloat zero = llvm::APFloat::getZero(llvm::APFloat::IEEEhalf, !positive); #endif return toFP16(zero); }
float16_t float16_t::mod(float16_t denominator, RoundingMode roundingMode) const { llvm::APFloat result = toLLVMAPF(*this); llvm::APFloat rhsAPF = toLLVMAPF(denominator); // FIXME: Ignoring possible exceptions // LLVM removed the rounding mode as the operation is always exact. // TODO: change float16_t::mod to no take a rounding mode. result.mod(rhsAPF); return toFP16(result); }
float16_t float16_t::operator-() const { llvm::APFloat result = toLLVMAPF(*this); result.changeSign(); return toFP16(result); }
float16_t float16_t::make_nan() { llvm::APFloat nan = llvm::APFloat::getNaN(llvm::APFloat::IEEEhalf); return toFP16(nan); }
float16_t float16_t::make_infinity(bool positive) { llvm::APFloat inf = llvm::APFloat::getInf(llvm::APFloat::IEEEhalf, !positive); return toFP16(inf); }
float16_t float16_t::make_zero(bool positive) { llvm::APFloat zero = llvm::APFloat::getZero(llvm::APFloat::IEEEhalf, !positive); return toFP16(zero); }