# ExKcal.SI (ExKcal v0.0.6)

Various SI prefixes-related functions etc.

# Link to this section Summary

## Types

Known SI prefixes.

Volume of substance and unit it is represented in.

Weight of substance and unit it is represented in.

## Functions

Extracts SI prefix from the unit.

Calculates shift required for prefix conversion.

Returns index of SI prefix relative to base (non-)prefix position. Negative shift factor will have negative index, positive factor will have positive index.

Returns list of tuples representing SI prefixes.

# si_prefix()

## Specs

```si_prefix() ::
:Y
| :Z
| :E
| :P
| :T
| :G
| :M
| :k
| :h
| :da
| :d
| :c
| :m
| :μ
| :n
| :p
| :f
| :a
| :z
| :y```

Known SI prefixes.

# volume()

## Specs

`volume() :: {float(), :l | :dl | :ml} | {nil, :none}`

Volume of substance and unit it is represented in.

# weight()

## Specs

`weight() :: {float(), :kg | :g | :mg | :μg} | {nil, :none}`

Weight of substance and unit it is represented in.

# extract_prefix(unit)

## Specs

`extract_prefix(atom()) :: si_prefix()`

Extracts SI prefix from the unit.

## Examples

``````iex> import ExKcal.SI
iex> extract_prefix(:kg)
:k
iex> extract_prefix(:dag)
:da``````

# prefix_conversion_factor(from, to)

## Specs

`prefix_conversion_factor(si_prefix(), si_prefix()) :: integer()`

Calculates shift required for prefix conversion.

## Examples

``````iex> import ExKcal.SI
iex> prefix_conversion_factor(:m, :M)
-9
iex> prefix_conversion_factor(:G, :m)
12``````

# prefix_index(prefix)

## Specs

`prefix_index(si_prefix()) :: integer()`

Returns index of SI prefix relative to base (non-)prefix position. Negative shift factor will have negative index, positive factor will have positive index.

## Examples

``````iex> import ExKcal.SI
iex> prefix_index(:m)
-3
iex> prefix_index(:M)
6``````
`prefixes() :: [{atom() | nil, si_prefix() | nil, number()}]`