Function const_real

Source
pub fn const_real(ty: &TypeRef, n: f64) -> ValueRef
Expand description

Obtain a constant value referring to a double floating point value.

§Details

Creates a constant floating-point value of a specified type.

This function wraps the LLVMConstReal function from the LLVM core library. It generates a constant floating-point value of the type specified by ty, using the provided floating-point number n. This is typically used to create floating-point constants within LLVM’s Intermediate Representation (IR) at compile time.

§Parameters

  • ty: A reference to the floating-point type (TypeRef) for the constant value. This type specifies the bit width of the floating-point value (e.g., f32, f64).
  • n: The floating-point value to be used for the constant. It will be interpreted according to the bit width of the target floating-point type.

§Returns

Returns an instance of ValueRef, which encapsulates the constant floating-point value determined at compile time.