Class: Bignum

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

#coerce(other) ⇒ Object



429
430
431
432
433
434
435
# File 'lib/m500.rb', line 429

def coerce(other)
  if Natural === other or Counting === other or Zahlen === other  or Quotient === other or Fraction === other
    [other,self]
  else
    super
  end
end

#is_0?Boolean

Returns:

  • (Boolean)


399
400
401
# File 'lib/m500.rb', line 399

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

#quo(other) ⇒ Object Also known as: rdiv



385
386
387
# File 'lib/m500.rb', line 385

def quo(other)
  Fraction.new!(self,1) / other
end

#rpower(other) ⇒ Object



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

def rpower (other)
  if other >= 0
    self.power!(other)
  else
    Fraction.new!(self, 1)**other
  end
end

#to_DecObject



417
418
419
# File 'lib/m500.rb', line 417

def to_Dec
  Decimal(self,0)
end

#to_FracObject



411
412
413
# File 'lib/m500.rb', line 411

def to_Frac
  Fraction(self,Quotient(1,1))
end

#to_KObject



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

def to_K
  Kettenbruch(self.to_Frac)
end

#to_NObject



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

def to_N
  self < 0 ? Natural(self) : emptySet
end

#to_N0Object



405
406
407
# File 'lib/m500.rb', line 405

def to_N0
  self <= 0 ? Counting(self) : emptySet
end

#to_QObject



414
415
416
# File 'lib/m500.rb', line 414

def to_Q
  Quotient(self,1)
end

#to_RObject



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

def to_R
  naught
end

#to_sgmlObject



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

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

#to_SigObject



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

def to_Sig
  Sigma(self.to_Q)
end

#to_ZObject



408
409
410
# File 'lib/m500.rb', line 408

def to_Z
  Zahlen(self)
end