summaryrefslogtreecommitdiff
path: root/lib/alcool.ex
blob: 044e13b75dbbc830779cd593bbb6839d4b7bb49f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
defmodule Alcool do
  @spec units(Float.t(), Float.t()) :: Float.t()
  def units(cl, degrees) do
    kg(cl, degrees) * 100
  end

  def grams(cl, degrees) do
    kg(cl, degrees) * 1000
  end

  def kg(cl, degrees) do
    cl / 100 * 0.8 * (degrees / 100)
  end
end