Module: Nio::Rtnlzr::Mth

Defined in:
lib/nio/rtnlzr.rb

Overview

Auxiliary floating-point functions

Class Method Summary collapse

Class Method Details

.abs(x) ⇒ Object



393
394
395
# File 'lib/nio/rtnlzr.rb', line 393

def self.abs(x)
  x.abs
end

.ceil(x) ⇒ Object



397
398
399
# File 'lib/nio/rtnlzr.rb', line 397

def self.ceil(x)
  x.ceil.to_i
end

.fp(x) ⇒ Object

:nodoc:



378
379
380
381
# File 'lib/nio/rtnlzr.rb', line 378

def self.fp(x)
  # y =x.modulo(1); return x<0 ? -y : y;
  x-ip(x)
end

.ip(x) ⇒ Object



383
384
385
386
# File 'lib/nio/rtnlzr.rb', line 383

def self.ip(x)
  # x.to_i.to_f
  (x<0 ? x.ceil : x.floor).to_i
end

.rnd(x) ⇒ Object



388
389
390
391
# File 'lib/nio/rtnlzr.rb', line 388

def self.rnd(x)
  #x.round.to_i
  x.round
end