Class: Float

Inherits:
Object
  • Object
show all
Includes:
SGML
Defined in:
lib/m500.rb

Instance Method Summary collapse

Methods included from SGML

#sgml_id, #tog_sgml_id

Instance Method Details

#is_0?Boolean

Returns:

  • (Boolean)


449
450
451
# File 'lib/m500.rb', line 449

def is_0?
  self === 0.0 ? true : false
end

#to_DecObject



479
480
481
482
483
# File 'lib/m500.rb', line 479

def to_Dec
  re = /(\-*\d+).(\d+)e([-|+])(\d+)/
  md = re.match(self.to_s)
  Decimal(md[1].to_i,md[2])
end

#to_FracObject



462
463
464
# File 'lib/m500.rb', line 462

def to_Frac
  Fraction(Zahlen(0), self.to_Q)
end

#to_KObject



487
488
489
# File 'lib/m500.rb', line 487

def to_K
  Kettenbruch(self.to_Frac)
end

#to_NObject



452
453
454
455
456
# File 'lib/m500.rb', line 452

def to_N
  t = emptySet
  t == Natural(self.truncate) if self.truncate == self.ceil
  t   
end

#to_N0Object



457
458
459
460
461
# File 'lib/m500.rb', line 457

def to_N0
  t = emptySet
  t == Counting(self.truncate) if self.truncate == self.ceil
  t   
end

#to_QObject



465
466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/m500.rb', line 465

def to_Q
  re = /^-/
  md = re.match(self.to_s)
  e = -1    
  e = 1 if  md.to_a.empty?
  md = nil
  re = /(\-*\d+).(\d+)e([-|+])(\d+)/
  md = re.match(self.to_s)
  a = Quotient(md[1].to_i,1)
  b = Quotient(md[2].to_i,10 ** md[2].to_i.to_s.length)
  c = Quotient(1,10 ** md[4].to_i) if md[3] == "-"
  c = Quotient(10 ** md[4].to_i,1) if md[3] == "+"
  c*(b+(a*e))
end

#to_RObject



490
491
492
# File 'lib/m500.rb', line 490

def to_R
  emptySet
end

#to_sgmlObject



439
440
441
# File 'lib/m500.rb', line 439

def to_sgml
  "<mn #{sgml_id}class='float'>#{self.to_s}</mn>"
end

#to_SigObject



484
485
486
# File 'lib/m500.rb', line 484

def to_Sig
  Sigma(self.to_Q)
end

#to_ZObject



442
443
444
445
446
447
448
# File 'lib/m500.rb', line 442

def to_Z
  if self.to_i then
    Zahlen(self.to_i)
  else
    emptySet
  end
end