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



368
369
370
371
372
373
374
# File 'lib/m500.rb', line 368

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)


338
339
340
# File 'lib/m500.rb', line 338

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

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



324
325
326
# File 'lib/m500.rb', line 324

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

#rpower(other) ⇒ Object



328
329
330
331
332
333
334
# File 'lib/m500.rb', line 328

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

#to_DecObject



356
357
358
# File 'lib/m500.rb', line 356

def to_Dec
  Decimal(self,0)
end

#to_FracObject



350
351
352
# File 'lib/m500.rb', line 350

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

#to_KObject



362
363
364
# File 'lib/m500.rb', line 362

def to_K
  Kettenbruch(self.to_Frac)
end

#to_NObject



341
342
343
# File 'lib/m500.rb', line 341

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

#to_N0Object



344
345
346
# File 'lib/m500.rb', line 344

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

#to_QObject



353
354
355
# File 'lib/m500.rb', line 353

def to_Q
  Quotient(self,1)
end

#to_RObject



365
366
367
# File 'lib/m500.rb', line 365

def to_R
  naught
end

#to_sgmlObject



317
318
319
# File 'lib/m500.rb', line 317

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

#to_SigObject



359
360
361
# File 'lib/m500.rb', line 359

def to_Sig
  Sigma(self.to_Q)
end

#to_ZObject



347
348
349
# File 'lib/m500.rb', line 347

def to_Z
  Zahlen(self)
end