Module: Numeric::Multipliers

Module | Numeric::Multipliers
In: | lib/more/facets/multipliers.rb

# Multipliers

Adds methods to Numeric to make working with magnitudes (kilo, mega, giga, milli, micro, etc.)

      1.kilo               #=> 1000
      1.milli              #=> 0.001
      1.kibi               #=> 1024

To display a value in a certain denomination, simply perform the inverse operation by placing the multiplier called on unit (1) in the denominator.

      1000 / 1.kilo        #=> 1
      1024 / 1.kibi        #=> 1

### Methods

atto centi deci deka exa exbi femto gibi giga hecto kibi kilo mebi mega micro milli nano pebi peta pico tebi tera

### Public Instance methods

atto()

[Source]

    # File lib/more/facets/multipliers.rb, line 76
        def atto  ; self.to_f / 1000000000000000000 ; end

centi()

[Source]

    # File lib/more/facets/multipliers.rb, line 70
        def centi ; self.to_f / 100 ; end

deci()

SI Fractional

[Source]

    # File lib/more/facets/multipliers.rb, line 69
        def deci  ; self.to_f / 10 ; end

deka()

SI Multipliers

[Source]

    # File lib/more/facets/multipliers.rb, line 58
        def deka  ; self * 10 ; end

exa()

[Source]

    # File lib/more/facets/multipliers.rb, line 65
        def exa   ; self * 1000000000000000000 ; end

exbi()

[Source]

    # File lib/more/facets/multipliers.rb, line 85
        def exbi ; self * 1024**6 ; end

femto()

[Source]

    # File lib/more/facets/multipliers.rb, line 75
        def femto ; self.to_f / 1000000000000000 ; end

gibi()

[Source]

    # File lib/more/facets/multipliers.rb, line 82
        def gibi ; self * 1024**3 ; end

giga()

[Source]

    # File lib/more/facets/multipliers.rb, line 62
        def giga  ; self * 1000000000 ; end

hecto()

[Source]

    # File lib/more/facets/multipliers.rb, line 59
        def hecto ; self * 100 ; end

kibi()

SI Binary

[Source]

    # File lib/more/facets/multipliers.rb, line 80
        def kibi ; self * 1024 ; end

kilo()

[Source]

    # File lib/more/facets/multipliers.rb, line 60
        def kilo  ; self * 1000 ; end

mebi()

[Source]

    # File lib/more/facets/multipliers.rb, line 81
        def mebi ; self * 1024**2 ; end

mega()

[Source]

    # File lib/more/facets/multipliers.rb, line 61
        def mega  ; self * 1000000 ; end

micro()

[Source]

    # File lib/more/facets/multipliers.rb, line 72
        def micro ; self.to_f / 1000000 ; end

milli()

[Source]

    # File lib/more/facets/multipliers.rb, line 71
        def milli ; self.to_f / 1000 ; end

nano()

[Source]

    # File lib/more/facets/multipliers.rb, line 73
        def nano  ; self.to_f / 1000000000 ; end

pebi()

[Source]

    # File lib/more/facets/multipliers.rb, line 84
        def pebi ; self * 1024**5 ; end

peta()

[Source]

    # File lib/more/facets/multipliers.rb, line 64
        def peta  ; self * 1000000000000000 ; end

pico()

[Source]

    # File lib/more/facets/multipliers.rb, line 74
        def pico  ; self.to_f / 1000000000000 ; end

tebi()

[Source]

    # File lib/more/facets/multipliers.rb, line 83
        def tebi ; self * 1024**4 ; end

tera()

[Source]

    # File lib/more/facets/multipliers.rb, line 63
        def tera  ; self * 1000000000000 ; end

[Validate]