Class: Flt::FieldsInBitsFormatBase

Inherits:
FormatBase show all
Defined in:
lib/float-formats/classes.rb

Overview

This is a base class for formats that specify the field lengths in bits

Direct Known Subclasses

BinaryFormat, HexadecimalFormat

Constant Summary

Constants included from Flt

APPLE, IEEE_128, IEEE_128_BE, IEEE_DEC128, IEEE_DEC32, IEEE_DEC64, IEEE_DOUBLE, IEEE_D_BE, IEEE_EXTENDED, IEEE_HALF, IEEE_H_BE, IEEE_QUAD, IEEE_Q_BE, IEEE_SINGLE, IEEE_S_BE, IEEE_X_BE, IEEE_binaryx, RPL, RPL_X

Instance Attribute Summary

Attributes inherited from FormatBase

#exponent, #sign, #significand

Class Method Summary collapse

Methods inherited from FormatBase

#<=>, arithmetic, arithmetic_type, bias, canonicalized, context, #convert_to, decimal_digits_necessary, decimal_digits_stored, decimal_max_exp, decimal_min_exp, define, endianness, epsilon, #form_class, #fp_format, from, from_bits, from_bits_text, from_bytes, from_hex, from_number, from_text, gradual_underflow?, half_epsilon, #infinite?, infinity, #initialize, join, max_value, maximum_integral_significand, min_normalized_value, min_value, minimum_normalized_integral_significand, #minus, minus_sign_value, nan, #nan?, #next_minus, #next_plus, #normal?, num, num_class, numerals_conversion, pack_fields_hash, radix_log, radix_log10, radix_max_exp, radix_min_exp, radix_power, rounding_mode, sign_from_unit, sign_to_unit, #split, strict_epsilon, #subnormal?, switch_sign_value, #to, #to_a, #to_bits, #to_bits_text, #to_bytes, #to_hex, #to_num, #to_text, #ulp, unpack_fields_hash, zero, #zero?

Methods included from Flt

#*, #+, #-, #-@, #/, bcd2dpd, bitnot, convert_bytes, dbl_from_float, dbl_from_text, dbl_to_float, define, dpd2bcd, dpd_to_hexbcd, float_bin, float_dec, float_from_integral_sign_significand_exponent, float_from_integral_significand_exponent, float_shortest_dec, float_significant_dec, float_to_integral_sign_significand_exponent, float_to_integral_significand_exponent, hex_from_float, hex_to_float, hexbcd_to_dpd, sgl_from_float, sgl_from_text, sgl_to_float

Constructor Details

This class inherits a constructor from Flt::FormatBase

Class Method Details

.fields_radixObject

:stopdoc:



1485
1486
1487
# File 'lib/float-formats/classes.rb', line 1485

def self.fields_radix
  2
end

.pack_fields(*fields) ⇒ Object



1491
1492
1493
1494
1495
# File 'lib/float-formats/classes.rb', line 1491

def self.pack_fields(*fields)
  fields = fields[0] if fields.size==1 and fields[0].kind_of?(Array)
  handle_fields fields
  Bytes.from_bitfields(@field_lengths,fields,@endianness)
end

.unpack_fields(v) ⇒ Object



1488
1489
1490
# File 'lib/float-formats/classes.rb', line 1488

def self.unpack_fields(v)
  input_bytes(v).to_bitfields(@field_lengths,@endianness)
end