Class: LLVM::RealType
Instance Attribute Summary
Attributes inherited from Type
Attributes included from PointerIdentity
Class Method Summary collapse
-
.fits(values) ⇒ Object
given an array of values or types, return the type that will fit all of them currently only works for floats and doubles : ([Value | Type]) -> RealType.
Instance Method Summary collapse
-
#from_f(value) ⇒ Object
: (Integer | ::Float | Rational | BigDecimal) -> ConstantReal.
-
#parse(str) ⇒ Object
: (untyped) -> ConstantReal.
-
#type ⇒ Object
: -> self.
Methods inherited from Type
#===, #aggregate?, #align, array, double, #dump, #element_type, float, from_ptr, function, integer, label, #literal_struct?, named, #null, #null_pointer, opaque_struct, #opaque_struct?, #packed_struct?, #pointer, pointer, #poison, ptr, #size, struct, #to_s, #undef, vector, void, x86_amx, x86_mmx
Methods included from PointerIdentity
Class Method Details
.fits(values) ⇒ Object
given an array of values or types, return the type that will fit all of them currently only works for floats and doubles : ([Value | Type]) -> RealType
323 324 325 |
# File 'lib/llvm/core/type.rb', line 323 def self.fits(values) values.detect { |v| v.type.to_s == 'double' } ? double : float end |
Instance Method Details
#from_f(value) ⇒ Object
: (Integer | ::Float | Rational | BigDecimal) -> ConstantReal
328 329 330 |
# File 'lib/llvm/core/type.rb', line 328 def from_f(value) ConstantReal.from_ptr(C.const_real(self, value.to_f)) end |
#parse(str) ⇒ Object
: (untyped) -> ConstantReal
333 334 335 |
# File 'lib/llvm/core/type.rb', line 333 def parse(str) ConstantReal.from_ptr(C.const_real_of_string(self, str.to_s)) end |
#type ⇒ Object
: -> self
338 339 340 |
# File 'lib/llvm/core/type.rb', line 338 def type self end |