Class: LLVM::ConstantReal
- Defined in:
- lib/llvm/core/value.rb
Instance Attribute Summary
Attributes included from PointerIdentity
Instance Method Summary collapse
-
#*(rhs) ⇒ Object
Returns the result of multiplying this ConstantReal by rhs.
-
#+(rhs) ⇒ Object
Returns the result of adding this ConstantReal to rhs.
-
#-(rhs) ⇒ Object
: (ConstantReal) -> ConstantReal.
-
#-@ ⇒ Object
Negation.
-
#/(rhs) ⇒ Object
Returns the result of dividing this ConstantReal by rhs.
-
#ext(type) ⇒ Object
(also: #sext)
Constant FPExt this is a signed extension was: self.class.from_ptr(C.const_fp_ext(self, type)).
-
#fcmp(_pred, _rhs) ⇒ Object
Floating point comparison using the predicate specified via the first parameter.
-
#rem(rhs) ⇒ Object
Remainder.
-
#to_f ⇒ Object
get double from value : -> ::Float.
-
#to_i(type) ⇒ Object
constant FPToSI LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType); was: self.class.from_ptr(C.const_fp_to_si(self, type)).
-
#trunc(type) ⇒ Object
was: self.class.from_ptr(C.const_fp_trunc(self, type)).
Methods inherited from Constant
#bitcast_to, #gep, #int_to_ptr, null, null_ptr, poison, #ptr_to_int, undef
Methods inherited from User
Methods inherited from Value
#add_attribute, #allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, #remove_attribute, to_ptr, #to_s, type, #type, #undef?
Methods included from PointerIdentity
Instance Method Details
#*(rhs) ⇒ Object
Returns the result of multiplying this ConstantReal by rhs. : (ConstantReal) -> ConstantReal
746 747 748 749 |
# File 'lib/llvm/core/value.rb', line 746 def *(rhs) type = LLVM::RealType.fits([self.type, rhs.type]) type.from_f(to_f * rhs.to_f) end |
#+(rhs) ⇒ Object
Returns the result of adding this ConstantReal to rhs. : (ConstantReal) -> ConstantReal
733 734 735 736 |
# File 'lib/llvm/core/value.rb', line 733 def +(rhs) type = LLVM::RealType.fits([self.type, rhs.type]) type.from_f(to_f + rhs.to_f) end |
#-(rhs) ⇒ Object
: (ConstantReal) -> ConstantReal
739 740 741 742 |
# File 'lib/llvm/core/value.rb', line 739 def -(rhs) type = LLVM::RealType.fits([self.type, rhs.type]) type.from_f(to_f - rhs.to_f) end |
#-@ ⇒ Object
Negation. fneg : -> ConstantReal
727 728 729 |
# File 'lib/llvm/core/value.rb', line 727 def -@ type.from_f(-to_f) end |
#/(rhs) ⇒ Object
Returns the result of dividing this ConstantReal by rhs. : (ConstantReal) -> ConstantReal
753 754 755 756 |
# File 'lib/llvm/core/value.rb', line 753 def /(rhs) type = LLVM::RealType.fits([self.type, rhs.type]) type.from_f(to_f / rhs.to_f) end |
#ext(type) ⇒ Object Also known as: sext
Constant FPExt this is a signed extension was: self.class.from_ptr(C.const_fp_ext(self, type))
797 798 799 |
# File 'lib/llvm/core/value.rb', line 797 def ext(type) type.from_f(to_f) end |
#fcmp(_pred, _rhs) ⇒ Object
Floating point comparison using the predicate specified via the first parameter. Predicate can be any of:
:ord - ordered
:uno - unordered: isnan(X) | isnan(Y)
:oeq - ordered and equal to
:oeq - unordered and equal to
:one - ordered and not equal to
:one - unordered and not equal to
:ogt - ordered and greater than
:uge - unordered and greater than or equal to
:olt - ordered and less than
:ule - unordered and less than or equal to
:oge - ordered and greater than or equal to
:sge - unordered and greater than or equal to
:ole - ordered and less than or equal to
:sle - unordered and less than or equal to
:true - always true
:false- always false
783 784 785 |
# File 'lib/llvm/core/value.rb', line 783 def fcmp(_pred, _rhs) raise DeprecationError end |
#rem(rhs) ⇒ Object
Remainder. : (ConstantReal) -> ConstantReal
760 761 762 763 |
# File 'lib/llvm/core/value.rb', line 760 def rem(rhs) type = LLVM::RealType.fits([self.type, rhs.type]) type.from_f(to_f.divmod(rhs.to_f).last) end |
#to_f ⇒ Object
get double from value : -> ::Float
809 810 811 812 813 814 815 |
# File 'lib/llvm/core/value.rb', line 809 def to_f double = 0.0 #: ::Float FFI::MemoryPointer.new(:bool, 1) do |loses_info| double = C.const_real_get_double(self, loses_info) #: ::Float end double end |
#to_i(type) ⇒ Object
constant FPToSI LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType); was: self.class.from_ptr(C.const_fp_to_si(self, type))
790 791 792 |
# File 'lib/llvm/core/value.rb', line 790 def to_i(type) type.from_i(to_f.to_i) end |
#trunc(type) ⇒ Object
was: self.class.from_ptr(C.const_fp_trunc(self, type))
803 804 805 |
# File 'lib/llvm/core/value.rb', line 803 def trunc(type) type.from_f(to_f) end |