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)


388
389
390
# File 'lib/m500.rb', line 388

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

#to_DecObject



418
419
420
421
422
# File 'lib/m500.rb', line 418

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

#to_FracObject



401
402
403
# File 'lib/m500.rb', line 401

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

#to_KObject



426
427
428
# File 'lib/m500.rb', line 426

def to_K
  Kettenbruch(self.to_Frac)
end

#to_NObject



391
392
393
394
395
# File 'lib/m500.rb', line 391

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

#to_N0Object



396
397
398
399
400
# File 'lib/m500.rb', line 396

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

#to_QObject



404
405
406
407
408
409
410
411
412
413
414
415
416
417
# File 'lib/m500.rb', line 404

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



429
430
431
# File 'lib/m500.rb', line 429

def to_R
  emptySet
end

#to_sgmlObject



378
379
380
# File 'lib/m500.rb', line 378

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

#to_SigObject



423
424
425
# File 'lib/m500.rb', line 423

def to_Sig
  Sigma(self.to_Q)
end

#to_ZObject



381
382
383
384
385
386
387
# File 'lib/m500.rb', line 381

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